diff --git a/.gitignore b/.gitignore
index 44d671029ece91beda71ece53e67a2d762f56f92..b301cf426004a72a511baae64c1a543ef8217630 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,49 +1,202 @@
-# backup files
+# Created by https://www.gitignore.io/api/vim,c++,root,python,fortran
+# Edit at https://www.gitignore.io/?templates=vim,c++,root,python,fortran
+
+### C++ ###
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+### Fortran ###
+# Prerequisites
+
+# Compiled Object files
+
+# Precompiled Headers
+
+# Compiled Dynamic libraries
+
+# Fortran module files
+
+# Compiled Static libraries
+
+# Executables
+
+### Python ###
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+### Python Patch ###
+.venv/
+
+### ROOT ###
+# ROOT Home Page : https://root.cern.ch/
+# ROOT Used by Experimental Physicists, not necessarily HEP
+# ROOT based on C++
+
+# Files generated by ROOT, observed with v6.xy
+
+*.pcm
+
+
+
+### Vim ###
+# Swap
+[._]*.s[a-v][a-z]
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+
+# Temporary
+.netrwhist
 *~
-.*.swp
-
-# build products
-InstallArea/
-
-# CMake temporary files
-build.*/
-.build/
-build-dir/
-CMakeFiles/
-CTestTestfile.cmake
-CPackSourceConfig.cmake
-CPackConfig.cmake
-cmake_install.cmake
-
-# common byproducts
-*.pyc
-*.pyo
-DoxyWarnings.log
-.gdb_history
-*.new
-*.launch
-*.launch.py
-*.launch.opts
-
-# Eclipse data
-.project
-.cproject
-.settings
-.pydevproject
-.eclipse/
-
-# CMT temporary files
-build.*.log
-Makefile
-NMake
-install.*.history
-setup.*
-cleanup.*
-version.cmt
-genConf/
-QMTest/
-test_results/
-*-slc[56]-*/
-i686-winxp-vc9-dbg/
-.*-slc[56]-*.d/
-.i686-winxp-vc9-dbg.d/
+# Auto-generated tag files
+tags
+# Persistent undo
+[._]*.un~
+
+# End of https://www.gitignore.io/api/vim,c++,root,python,fortran
diff --git a/Bcm/.gaudi_project_ignore b/Bcm/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Bls/.gaudi_project_ignore b/Bls/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a607490752bd40860b2bcb6c7ad0852b4af7a9a..7af0423666ad46437b840861d6ad91f4fdd4f9ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
 #---------------------------------------------------------------
 # Load macros and functions for Gaudi-based projects
 find_package(GaudiProject)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 #---------------------------------------------------------------
 
 macro(FindG4libs)
@@ -19,11 +20,15 @@ macro(FindG4libs)
     link_directories(${Geant4_LIBRARY_DIRS})
 endmacro()
 
+macro(AddHepMC3)
+    include_directories(SYSTEM ${Gaussino_DIR}/include)
+    link_directories(${Gaussino_DIR}/lib)
+endmacro()
+
 # Declare project name and version
-gaudi_project(Gauss v53r2
+gaudi_project(Gauss v60r0
               FORTRAN
-              USE LHCb v50r4
-                  Geant4 v104r3p1
+              USE Gaussino v1r0
               DATA AppConfig VERSION v3r*
                    BcVegPyData VERSION v3r*
                    Det/GDMLData VERSION v1r*
diff --git a/Calo/CaloMoniSim/src/MCCaloMonitor.cpp b/Calo/CaloMoniSim/src/MCCaloMonitor.cpp
index 1d568b85ad9d230d6325e46e0d3cf2e3d37a1612..9ec2b7d7136e9248dd9d6953691bcac92513fc4a 100755
--- a/Calo/CaloMoniSim/src/MCCaloMonitor.cpp
+++ b/Calo/CaloMoniSim/src/MCCaloMonitor.cpp
@@ -2,20 +2,21 @@
 
 // STL
 #include <stdio.h>
-#include <string>
 #include <algorithm>
+#include <string>
 
 // from Gaudi
 #include "Kernel/CaloCellID.h"
 // from Event
+#include "Event/MCCaloDigit.h"
 #include "Event/MCHit.h"
 #include "Event/MCParticle.h"
 #include "Event/MCVertex.h"
-#include "Event/MCCaloDigit.h"
 // OD : RENAMING >>>> WAIT FOR NEW NAME/LOCATION - COMMENTED IN THE MEANTIME
 //#include "Event/MCCaloSensPlaneHit.h"
 
 // Gaudi Histograms:
+#include "AIDA/IHistogram1D.h"
 #include "GaudiAlg/GaudiHistoAlg.h"
 
 // local
@@ -32,121 +33,56 @@ using namespace LHCb;
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_COMPONENT( MCCaloMonitor )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-MCCaloMonitor::MCCaloMonitor( const std::string& name,
-                              ISvcLocator* pSvcLocator)
-  : GaudiHistoAlg ( name , pSvcLocator )
-  , m_nameOfMCHits              ( "" )
-  , m_GeometryRoot        ( "/dd/Structure/LHCb/DownstreamRegion/" )
-  , m_DivMonitor                ( false      )
-  , m_MaxE                 (  10 * Gaudi::Units::MeV  )
-  , m_MinE                 (   0 * Gaudi::Units::MeV  )
-  , m_Threshold                 ( 1.5 * Gaudi::Units::MeV  )
-  , m_MaxT                   (  7   )
-  , m_MinT                   (  -1   )
-  , m_hDir                  ( " "   )
-  , m_nEvents                   (   0   )
-  , m_DetectorName              ( " "   )
-  , m_textNorm ("Norm")
-{
-  declareProperty("GeometryRoot"    , m_GeometryRoot    );
-  declareProperty("Regions"         , m_DivMonitor            );
-  declareProperty("MaximumEnergy"   , m_MaxE            );
-  declareProperty("MinimumEnergy"   , m_MinE            );
-  declareProperty("MaximumTime"     , m_MaxT              );
-  declareProperty("Threshold"       , m_Threshold            );
-  declareProperty("MinimumTime"     , m_MinT              );
-  declareProperty("hDir"            , m_hDir             );
-  declareProperty("Detector"        , m_Detector             );
-  declareProperty("DetectorName"    , m_DetectorName         );
-  declareProperty("MCParticles"     , m_mcParticles = MCParticleLocation::Default ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-MCCaloMonitor::~MCCaloMonitor() {}
+DECLARE_COMPONENT(MCCaloMonitor)
 
 //=============================================================================
 // Initialisation. Check parameters
 //=============================================================================
 StatusCode MCCaloMonitor::initialize() {
-  StatusCode sc = GaudiHistoAlg::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
+  StatusCode sc = GaudiHistoAlg::initialize();  // must be executed first
+  if (sc.isFailure()) return sc;  // error printed already by GaudiAlgorithm
 
   info() << "==> Initialise Monitoring " << m_Detector << endmsg;
 
   m_hDir = m_Detector;
-  m_nameOfMCHits = "MC/" + m_Detector + "/Hits";
-  if (m_Detector == "Spd"){
+  if (m_Detector == "Spd") {
     m_DetectorName = "SPD";
-  }
-  if (m_Detector == "Prs"){
+  } else if (m_Detector == "Prs") {
     m_DetectorName = "PS";
-  }
-  if (m_Detector == "Ecal"){
+  } else if (m_Detector == "Ecal") {
     m_DetectorName = "ECAL";
-  }
-  if (m_Detector == "Hcal"){
+  } else if (m_Detector == "Hcal") {
     m_DetectorName = "HCAL";
+  } else {
+    return Error("Invalid detector provided: " + m_Detector);
   }
 
   // Histograms
 
-  m_hName1  = "Subhits in the " + m_DetectorName;
-  m_hName1a = "Subhits in the INNER " + m_DetectorName;
-  m_hName1b = "Subhits in the MIDDLE " + m_DetectorName;
-  m_hName1c = "Subhits in the OUTER " + m_DetectorName;
-  m_hName2  = "Energy Weighted Subhits in the " + m_DetectorName;
-  m_hName2a = "Energy Weighted Subhits in the INNER " + m_DetectorName;
-  m_hName2b = "Energy Weighted Subhits in the MIDDLE " + m_DetectorName;
-  m_hName2c = "Energy Weighted Subhits in the OUTER" + m_DetectorName;
-  m_hName3  = "Accumulated Energy in the " + m_DetectorName;
-  m_hName3a = "Accumulated Energy in the INNER " + m_DetectorName;
-  m_hName3b = "Accumulated Energy in the MIDDLE " + m_DetectorName;
-  m_hName3c = "Accumulated Energy in the OUTER " + m_DetectorName;
-  m_hName4  = "Number of Subhits in the " + m_DetectorName;
-  m_hName40 = "Number of Subhits in the " + m_DetectorName + " ( BC = -1 )";
-  m_hName41 = "Number of Subhits in the " + m_DetectorName + " ( BC = 0  )";
-  m_hName42 = "Number of Subhits in the " + m_DetectorName + " ( BC = 1  )";
-  m_hName43 = "Number of Subhits in the " + m_DetectorName + " ( BC = 2  )";
-  m_hName44 = "Number of Subhits in the " + m_DetectorName + " ( BC = 3  )";
-  m_hName45 = "Number of Subhits in the " + m_DetectorName + " ( BC = 4  )";
-  m_Bin = int(m_MaxT-m_MinT+1);
-  MinT = 1.*m_MinT - 0.5;
-  MaxT = 1.*m_MaxT + 0.501;
-
-  m_detector = getDet<DeCalorimeter>(m_GeometryRoot + m_Detector);
-  if( 0 == m_detector ) {
-    error() <<
-      "Cannot locate Detector Element ="<< m_GeometryRoot+m_Detector << endmsg;
-    return StatusCode::FAILURE ;
+  m_Bin = int(m_MaxT - m_MinT + 1);
+  MinT = 1. * m_MinT - 0.5;
+  MaxT = 1. * m_MaxT + 0.501;
+
+  m_detector = getDet<DeCalorimeter>(m_GeometryRoot.value() + m_Detector.value());
+  if (0 == m_detector) {
+    error() << "Cannot locate Detector Element =" << m_GeometryRoot.value() + m_Detector.value()
+            << endmsg;
+    return StatusCode::FAILURE;
   }
-  
+
+  bookHistograms();
+
   return StatusCode::SUCCESS;
 }
 
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode MCCaloMonitor::execute() {
-
-  ++m_nEvents;
-  m_nEvents  = 1;
+void MCCaloMonitor::operator()(const LHCb::MCCaloHits& CaloHits) const {
   debug() << "Execute Monitoring " << m_Detector << endmsg;
 
-  MCCaloHits::const_iterator iHit;
-
-  // Get the MCHits
-  const MCCaloHits * CaloHits = get<MCCaloHits>(m_nameOfMCHits);
-
   // Get the MCParticles
-  //const MCParticles * mcParts = get<MCParticles>(m_mcParticles);
+  // const MCParticles * mcParts = get<MCParticles>(m_mcParticles);
 
   int hits_Counter = 0;
 
@@ -157,92 +93,135 @@ StatusCode MCCaloMonitor::execute() {
   int hits_CounterBC3 = 0;
   int hits_CounterBC4 = 0;
 
-  for ( iHit = CaloHits->begin(); iHit != CaloHits->end() ; ++iHit ){
-
+  std::lock_guard<std::mutex> locker{m_histo_mutex};
+  for (auto hit : CaloHits) {
     // NORMAL ENERGY SUBHITS HISTOGRAMS
     int binTime;
-    if ( (*iHit)->time() >= 7){
-      binTime = 7 ;
-    }
-    else {
-      binTime=(*iHit)->time();
+    if (hit->time() >= 7) {
+      binTime = 7;
+    } else {
+      binTime = hit->time();
     }
-    CaloCellID ID = (*iHit)->cellID();
+    CaloCellID ID = hit->cellID();
     int zone = ID.area();
 
-    plot1D( (*iHit)->activeE(),11,m_hName1,m_MinE,m_MaxE,100,1./m_nEvents) ;
-    plot1D( (*iHit)->activeE(),12,m_hName2,m_MinE,m_MaxE,100,((*iHit)->activeE())/m_nEvents) ;
-    plot1D( binTime,13,m_hName3,MinT,MaxT,m_Bin,((*iHit)->activeE())/m_nEvents) ;
+    m_hName1->fill(hit->activeE(), 1.);
+    m_hName2->fill(hit->activeE(), hit->activeE());
+    m_hName3->fill(binTime, hit->activeE());
     if (m_DivMonitor) {
-      if ( ( 2 == zone && m_DetectorName != "Hcal" ) ||
-           ( 1 == zone && m_DetectorName == "Hcal" ) ){
-        if ( m_detector->valid(ID) ){
-          plot1D((*iHit)->activeE(),111,m_hName1a,m_MinE,m_MaxE,100,1./m_nEvents) ;
-          plot1D((*iHit)->activeE(),121,m_hName2a,m_MinE,m_MaxE,100,((*iHit)->activeE())/m_nEvents) ;
-          plot1D(binTime,131,m_hName3a,MinT,MaxT,m_Bin,((*iHit)->activeE())/m_nEvents) ;
+      if ((2 == zone && m_DetectorName != "Hcal") ||
+          (1 == zone && m_DetectorName == "Hcal")) {
+        if (m_detector->valid(ID)) {
+          m_hName1a->fill(hit->activeE(), 1.);
+          m_hName2a->fill(hit->activeE(), hit->activeE());
+          m_hName3a->fill(binTime, hit->activeE());
         }
       }
-      if ( ( 1 == zone   && m_DetectorName != "Hcal" ) ){
-        if ( m_detector->valid(ID) ){
-          plot1D((*iHit)->activeE(),112,m_hName1b,m_MinE,m_MaxE,100,1./m_nEvents) ;
-          plot1D((*iHit)->activeE(),122,m_hName2b,m_MinE,m_MaxE,100,((*iHit)->activeE())/m_nEvents) ;
-          plot1D(binTime,132,m_hName3b,MinT,MaxT,m_Bin,((*iHit)->activeE())/m_nEvents) ;
+      if ((1 == zone && m_DetectorName != "Hcal")) {
+        if (m_detector->valid(ID)) {
+          m_hName1b->fill(hit->activeE(), 1.);
+          m_hName2b->fill(hit->activeE(), hit->activeE());
+          m_hName3b->fill(binTime, hit->activeE());
         }
       }
-      if ( 0 == zone ) {
-        if ( m_detector->valid(ID) ){
-          plot1D((*iHit)->activeE(),113,m_hName1c,m_MinE,m_MaxE,100,1./m_nEvents) ;
-          plot1D((*iHit)->activeE(),123,m_hName2c,m_MinE,m_MaxE,100,((*iHit)->activeE())/m_nEvents) ;
-          plot1D(binTime,133,m_hName3c,MinT,MaxT,m_Bin,((*iHit)->activeE())/m_nEvents) ;
+      if (0 == zone) {
+        if (m_detector->valid(ID)) {
+          m_hName1c->fill(hit->activeE(), 1.);
+          m_hName2c->fill(hit->activeE(), hit->activeE());
+          m_hName3c->fill(binTime, hit->activeE());
         }
       }
     }
     // BUNCH CROSSING HISTOGRAMS
-    if ( (*iHit)->activeE() >= m_Threshold ){
+    if (hit->activeE() >= m_Threshold) {
       hits_Counter = hits_Counter + 1;
-      switch ((*iHit)->time()){
-      case -1:
-        ++hits_CounterBC_1;
-        break;
-      case 0:
-        ++hits_CounterBC0 ;
-        break;
-      case 1:
-        ++hits_CounterBC1 ;
-        break;
-      case 2:
-        ++hits_CounterBC2 ;
-        break;
-      case 3:
-        ++hits_CounterBC3;
-        break;
-      case 4:
-        ++hits_CounterBC4;
-        break;
+      switch (hit->time()) {
+        case -1:
+          ++hits_CounterBC_1;
+          break;
+        case 0:
+          ++hits_CounterBC0;
+          break;
+        case 1:
+          ++hits_CounterBC1;
+          break;
+        case 2:
+          ++hits_CounterBC2;
+          break;
+        case 3:
+          ++hits_CounterBC3;
+          break;
+        case 4:
+          ++hits_CounterBC4;
+          break;
       }
     }
-  } // end for
-
-  plot1D(hits_Counter,14,m_hName4,0,1000,100,1.);
-  plot1D(hits_CounterBC_1,140,m_hName40,0,1000,100,1.);
-  plot1D(hits_CounterBC0,141,m_hName41,0,1000,100,1.);
-  plot1D(hits_CounterBC1,142,m_hName42,0,1000,100,1.);
-  plot1D(hits_CounterBC2,143,m_hName43,0,1000,100,1.);
-  plot1D(hits_CounterBC3,144,m_hName44,0,1000,100,1.);
-  plot1D(hits_CounterBC4,145,m_hName45,0,1000,100,1.);
-  return StatusCode::SUCCESS;
+  }  // end for
+
+  m_hName4->fill(hits_Counter, 1.);
+  m_hName40->fill(hits_CounterBC_1, 1.);
+  m_hName41->fill(hits_CounterBC0, 1.);
+  m_hName42->fill(hits_CounterBC1, 1.);
+  m_hName43->fill(hits_CounterBC2, 1.);
+  m_hName44->fill(hits_CounterBC3, 1.);
+  m_hName45->fill(hits_CounterBC4, 1.);
 }
 
 //=============================================================================
 //  Finalize
 //=============================================================================
 StatusCode MCCaloMonitor::finalize() {
-
-  info()<< "Finalize Monitoring " << m_Detector << endmsg;
+  info() << "Finalize Monitoring " << m_Detector << endmsg;
   return GaudiHistoAlg::finalize();  // must be called after all other actions
 }
 
-
-// ============================================================================
-// The END
-// ============================================================================
+void MCCaloMonitor::bookHistograms() {
+  std::string tmp_hName1 = "Subhits in the " + m_DetectorName;
+  std::string tmp_hName1a = "Subhits in the INNER " + m_DetectorName;
+  std::string tmp_hName1b = "Subhits in the MIDDLE " + m_DetectorName;
+  std::string tmp_hName1c = "Subhits in the OUTER " + m_DetectorName;
+  std::string tmp_hName2 = "Energy Weighted Subhits in the " + m_DetectorName;
+  std::string tmp_hName2a =
+      "Energy Weighted Subhits in the INNER " + m_DetectorName;
+  std::string tmp_hName2b =
+      "Energy Weighted Subhits in the MIDDLE " + m_DetectorName;
+  std::string tmp_hName2c =
+      "Energy Weighted Subhits in the OUTER" + m_DetectorName;
+  std::string tmp_hName3 = "Accumulated Energy in the " + m_DetectorName;
+  std::string tmp_hName3a = "Accumulated Energy in the INNER " + m_DetectorName;
+  std::string tmp_hName3b =
+      "Accumulated Energy in the MIDDLE " + m_DetectorName;
+  std::string tmp_hName3c = "Accumulated Energy in the OUTER " + m_DetectorName;
+  std::string tmp_hName4 = "Number of Subhits in the " + m_DetectorName;
+  std::string tmp_hName40 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = -1 )";
+  std::string tmp_hName41 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = 0  )";
+  std::string tmp_hName42 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = 1  )";
+  std::string tmp_hName43 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = 2  )";
+  std::string tmp_hName44 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = 3  )";
+  std::string tmp_hName45 =
+      "Number of Subhits in the " + m_DetectorName + " ( BC = 4  )";
+  m_hName1 = book1D(11, tmp_hName1, m_MinE, m_MaxE, 100);
+  m_hName1a = book1D(111, tmp_hName1a, m_MinE, m_MaxE, 100);
+  m_hName1b = book1D(112, tmp_hName1b, m_MinE, m_MaxE, 100);
+  m_hName1c = book1D(113, tmp_hName1c, m_MinE, m_MaxE, 100);
+  m_hName2 = book1D(12, tmp_hName2, m_MinE, m_MaxE, 100);
+  m_hName2a = book1D(121, tmp_hName2a, m_MinE, m_MaxE, 100);
+  m_hName2b = book1D(122, tmp_hName2b, m_MinE, m_MaxE, 100);
+  m_hName2c = book1D(123, tmp_hName2c, m_MinE, m_MaxE, 100);
+  m_hName3 = book1D(13, tmp_hName3, MinT, MaxT, m_Bin);
+  m_hName3a = book1D(131, tmp_hName3a, MinT, MaxT, m_Bin);
+  m_hName3b = book1D(132, tmp_hName3b, MinT, MaxT, m_Bin);
+  m_hName3c = book1D(133, tmp_hName3c, MinT, MaxT, m_Bin);
+  m_hName4 = book1D(14, tmp_hName4, 0, 1000, 100);
+  m_hName40 = book1D(140, tmp_hName40, 0, 1000, 100);
+  m_hName41 = book1D(141, tmp_hName41, 0, 1000, 100);
+  m_hName42 = book1D(142, tmp_hName42, 0, 1000, 100);
+  m_hName43 = book1D(143, tmp_hName43, 0, 1000, 100);
+  m_hName44 = book1D(144, tmp_hName44, 0, 1000, 100);
+  m_hName45 = book1D(145, tmp_hName45, 0, 1000, 100);
+}
diff --git a/Calo/CaloMoniSim/src/MCCaloMonitor.h b/Calo/CaloMoniSim/src/MCCaloMonitor.h
index 0092759013eed11817abf51e6329d6ae6e7b9419..f10ee752d4dda39d154111b4d9bcaeeb202a0b56 100755
--- a/Calo/CaloMoniSim/src/MCCaloMonitor.h
+++ b/Calo/CaloMoniSim/src/MCCaloMonitor.h
@@ -1,31 +1,14 @@
-// $Id: MCCaloMonitor.h,v 1.5 2009-10-23 10:45:22 jonrob Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.4  2009/03/26 21:55:03  robbep
-// changes for spill over generation
-//
-// Revision 1.3  2006/02/13 12:03:00  odescham
-// v2r1 migration to GaudiHistoAlg completed - structure pathes adapted to new enveloppes
-//
-// Revision 1.2  2005/12/16 17:53:59  odescham
-// v2r0 - LHCb v20 migration
-//
-// Revision 1.1.1.1  2004/10/25 08:53:25  ibelyaev
-// // New Package: code imported from Calo/CaloMonitor
-//
-// ============================================================================
-#ifndef MCCALOMONITOR_H
-#define MCCALOMONITOR_H 1
+#pragma once
 
 // Include files
 // from STL
 #include <cmath>
 #include <string>
 #include <vector>
+#include "GaudiAlg/Consumer.h"
 // from Calo
 #include "CaloDet/DeCalorimeter.h"
+#include "Event/MCCaloHit.h"
 
 /** @class MCCaloMonitor MCCaloMonitor.h
  *
@@ -38,79 +21,62 @@
 
 // histograms
 
-class MCCaloMonitor : public GaudiHistoAlg {
-public:
+class MCCaloMonitor
+    : public Gaudi::Functional::Consumer<
+          void(const LHCb::MCCaloHits&),
+          Gaudi::Functional::Traits::BaseClass_t<GaudiHistoAlg>> {
+  public:
   /// Standard constructor
-  MCCaloMonitor( const std::string& name, ISvcLocator* pSvcLocator );
+  MCCaloMonitor(const std::string& name, ISvcLocator* pSvcLocator)
+      : Consumer(name, pSvcLocator,
+                 {KeyValue{"MCCaloHits", LHCb::MCCaloHitLocation::Ecal}}){};
 
-  virtual ~MCCaloMonitor( ); ///< Destructor
+  virtual ~MCCaloMonitor() = default;  ///< Destructor
 
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
+  StatusCode initialize() override;  ///< Algorithm initialization
+  void operator()(const LHCb::MCCaloHits&) const override;
+  StatusCode finalize() override;  ///< Algorithm finalization
 
-
-private:
+  private:
   // histograms:
 
-  std::string m_nameOfMCHits           ;
-  std::string m_hName1;
-  std::string m_hName1a;
-  std::string m_hName1b;
-  std::string m_hName1c;
-  std::string m_hName2;
-  std::string m_hName2a;
-  std::string m_hName2b;
-  std::string m_hName2c;
-  std::string m_hName3;
-  std::string m_hName3a;
-  std::string m_hName3b;
-  std::string m_hName3c;
-  std::string m_hName4;
-  std::string m_hName40;
-  std::string m_hName41;
-  std::string m_hName42;
-  std::string m_hName43;
-  std::string m_hName44;
-  std::string m_hName45;
-
-  std::string m_hNameNorm1;
-  std::string m_hNameNorm2;
-
-
-
-
-
-
-  std::string m_GeometryRoot ;
-  bool m_DivMonitor;
-  double m_MaxE;
-  double m_MinE;
-  double m_Threshold;
-  int m_MaxT;
-  double MaxT;
-  int m_MinT;
-  double MinT;
-  std::string m_hDir;
-  int m_nEvents;
-  std::string m_Detector;
-  std::string m_DetectorName;
-  std::string m_mcParticles ;
-
-  const std::string m_textNorm;
-
+  AIDA::IHistogram1D* m_hName1{nullptr};
+  AIDA::IHistogram1D* m_hName1a{nullptr};
+  AIDA::IHistogram1D* m_hName1b{nullptr};
+  AIDA::IHistogram1D* m_hName1c{nullptr};
+  AIDA::IHistogram1D* m_hName2{nullptr};
+  AIDA::IHistogram1D* m_hName2a{nullptr};
+  AIDA::IHistogram1D* m_hName2b{nullptr};
+  AIDA::IHistogram1D* m_hName2c{nullptr};
+  AIDA::IHistogram1D* m_hName3{nullptr};
+  AIDA::IHistogram1D* m_hName3a{nullptr};
+  AIDA::IHistogram1D* m_hName3b{nullptr};
+  AIDA::IHistogram1D* m_hName3c{nullptr};
+  AIDA::IHistogram1D* m_hName4{nullptr};
+  AIDA::IHistogram1D* m_hName40{nullptr};
+  AIDA::IHistogram1D* m_hName41{nullptr};
+  AIDA::IHistogram1D* m_hName42{nullptr};
+  AIDA::IHistogram1D* m_hName43{nullptr};
+  AIDA::IHistogram1D* m_hName44{nullptr};
+  AIDA::IHistogram1D* m_hName45{nullptr};
+  void bookHistograms();
+
+  Gaudi::Property<std::string> m_GeometryRoot{
+      this, "GeometryRoot", "/dd/Structure/LHCb/DownstreamRegion/"};
+  Gaudi::Property<bool> m_DivMonitor{this, "Regions", false};
+  Gaudi::Property<double> m_MaxE{this, "MaximumEnergy", 10 * Gaudi::Units::MeV};
+  Gaudi::Property<double> m_MinE{this, "MinimumEnergy", 0 * Gaudi::Units::MeV};
+  Gaudi::Property<double> m_Threshold{this, "Threshold",
+                                      1.5 * Gaudi::Units::MeV};
+  Gaudi::Property<int> m_MaxT{this, "MaximumTime", 7};
+  Gaudi::Property<int> m_MinT{this, "MinimumTime", -1};
+  double MinT, MaxT;
   int m_Bin;
+  std::string m_hDir;
+  Gaudi::Property<std::string> m_Detector{this, "Detector", ""};
+  std::string m_DetectorName{};
 
-  DeCalorimeter * m_detector;
-
-protected:
-
+  // FIXME: Split this out to support different geometries
+  DeCalorimeter* m_detector{nullptr};
+  mutable std::mutex m_histo_mutex;
 };
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif // MCCALOMONITOR_H
-// ============================================================================
-
-
diff --git a/Example/LHCbLumi/CMakeLists.txt b/Example/LHCbLumi/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..969959df41068831c9c60916913aa96f11183dc5
--- /dev/null
+++ b/Example/LHCbLumi/CMakeLists.txt
@@ -0,0 +1,25 @@
+################################################################################
+# Package: LHCbLumi
+################################################################################
+gaudi_subdir(LHCbLumi v1r0)
+
+gaudi_depends_on_subdirs(GaudiAlg
+                         Sim/GiGaMTCore
+                         Det/DetDesc
+                         HepMC3
+                         Sim/GiGaMTFactories)
+
+find_package(Boost)
+find_package(ROOT COMPONENTS Tree TreePlayer RIO REQUIRED)
+find_package(CLHEP)
+AddHepMC3()
+include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS} ${HEPMC3_INCLUDE_DIR})
+
+add_definitions(-DG4MULTITHREADED)
+add_definitions(-DG4USE_STD11)
+
+gaudi_add_module(LHCbLumi
+                 src/*.cpp
+                 LINK_LIBRARIES DetDescLib Geant4 GiGaMTCoreTruthLib GaudiAlgLib ROOT)
+
+gaudi_env(SET LHCBLUMIOPTS \${LHCBLUMIROOT}/options)
diff --git a/Example/LHCbLumi/options/setup.py b/Example/LHCbLumi/options/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..162c26624405970a117437ed337cc4468b14f69a
--- /dev/null
+++ b/Example/LHCbLumi/options/setup.py
@@ -0,0 +1,89 @@
+from Gaudi.Configuration import importOptions
+from Gaussino.Generation import GenPhase
+
+from Configurables import Gauss, CondDB, LHCbApp
+importOptions("$APPCONFIGOPTS/Gauss/Beam7000GeV-md100-nu7.6-HorExtAngle.py")
+
+CondDB().Upgrade = True
+LHCbApp().DDDBtag = "dddb-20171010"
+LHCbApp().CondDBtag = "sim-20170301-vc-md100"
+
+CondDB().Upgrade = True
+Gauss().DataType = "Upgrade"
+
+from Gauss.Geometry import LHCbGeo
+LHCbGeo().DetectorGeo = {"Detectors": ['VP', 'Magnet']}
+LHCbGeo().DetectorSim = {"Detectors": []}
+LHCbGeo().DetectorMoni = {"Detectors": []}
+
+LHCbGeo().ExtraGeoTools = ['AddLumiDetectorTool']
+LHCbGeo().SensDetMap = {'LumiSensitiveDetector/LSD':
+                        ["sector out {}".format(j + 1) for j in range(100)]
+                        }
+
+from Configurables import GiGaMTDetectorConstructionFAC
+from Configurables import GiGaMT
+giga = GiGaMT()
+dettool = giga.addTool(GiGaMTDetectorConstructionFAC,
+                       "GiGaMTDetectorConstructionFAC")
+dettool.Output = "Dump.gdml"
+
+from Configurables import LumiSensitiveDetector
+lsd = dettool.addTool(LumiSensitiveDetector,
+                       "LSD")
+# giga.OutputLevel = 1
+
+from Configurables import ApplicationMgr, MakeLumiHitsTuple
+# ApplicationMgr().ExtSvc += ["NTupleSvc"];
+# from Gaudi.Configuration import NTupleSvc
+# NTupleSvc().Output = ["FILE1 DATAFILE='LumiHits.root' OPT='NEW'"];
+ApplicationMgr().TopAlg += [MakeLumiHitsTuple(
+    CollectionName='LSD/Hits')]
+
+from Gauss import G4Physics
+G4Physics().AddPhysConstr = ["GiGaMT_G4OpticalPhysics"]
+
+from Configurables import Generation
+Generation().EventType = 30000000
+
+GenPhase().ProductionTool = "Pythia8Production"
+GenPhase().SampleGenerationTool = "MinimumBias"
+GenPhase().DecayTool = "EvtGenDecay"
+GenPhase().CutTool = ""
+
+from Configurables import ToolSvc
+from Configurables import EvtGenDecay
+ToolSvc().addTool(EvtGenDecay)
+ToolSvc().EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/minbias.dec"
+
+
+from Configurables import Gauss
+nthreads = 3
+
+# GenPhase().Production = 'P8MB'
+GenPhase().GenMonitor = True
+Gauss().EvtMax = 100
+Gauss().EnableHive = True
+
+Gauss().ThreadPoolSize = nthreads
+Gauss().EventSlots = nthreads
+Gauss().ConvertEDM = True
+
+from Configurables import GenRndInit
+GenRndInit().FirstEventNumber = 10042
+GenRndInit().TimingSkipAtStart = 10
+
+from Configurables import GiGaMT
+giga = GiGaMT()
+giga.NumberOfWorkerThreads = nthreads
+
+from Gaudi.Configuration import appendPostConfigAction
+
+def force_engine():
+    from Gaussino.Utilities import get_set_configurable
+    from Configurables import GiGaMT
+    giga = GiGaMT()
+    actioninit = get_set_configurable(giga, 'ActionInitializer')
+    actioninit.TrackingActions += ["DebugTrackAction"]
+
+# appendPostConfigAction(force_engine)
diff --git a/Example/LHCbLumi/src/AddLumiDetectorTool.cpp b/Example/LHCbLumi/src/AddLumiDetectorTool.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..030ddabc7373510f602d1daf3a40589fa2a21ba3
--- /dev/null
+++ b/Example/LHCbLumi/src/AddLumiDetectorTool.cpp
@@ -0,0 +1,518 @@
+/*
+ * AddLumiDetectorTool.cpp
+ *
+ *  Created on: Oct 2, 2018
+ *      Author: vsevolod
+ */
+
+#include "AddLumiDetectorTool.h"
+#include "Geant4/G4LogicalVolumeStore.hh"
+#include "Geant4/G4Trap.hh"
+
+#include "LumiVolumeStructures.h"
+
+DECLARE_COMPONENT(AddLumiDetectorTool)
+
+StatusCode AddLumiDetectorTool::initialize() {
+  auto sc = extends::initialize();
+  G4String symbol;
+  G4double a, z, density;
+  G4int ncomponents, natoms;
+  G4double fractionmass;
+
+  G4NistManager *man = G4NistManager::Instance();
+
+  G4Element *N =
+      new G4Element("Nitrogen", symbol = "N", z = 7., a = 14.01 * g / mole);
+  G4Element *O =
+      new G4Element("Oxygen", symbol = "O", z = 8., a = 16.00 * g / mole);
+  G4Element *Si =
+      new G4Element("Silicon", symbol = "Si", z = 14., a = 28.09 * g / mole);
+  Air = new G4Material("Air", density = 0.000290 * mg / cm3, ncomponents = 2);
+  Air->AddElement(N, fractionmass = 0.7);
+  Air->AddElement(O, fractionmass = 0.3);
+  worldMaterial = Air;
+
+  G4Material *Scint = man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
+  ScintMaterial = Scint;
+
+  INOX = man->FindOrBuildMaterial("G4_STAINLESS-STEEL");
+
+  Beryllium = man->FindOrBuildMaterial("G4_Be");
+  Copper = man->FindOrBuildMaterial("G4_Cu");
+
+  BPMaterial = Copper;
+  BPMaterial = Beryllium;
+
+  Vacuum = new G4Material("Galactic", z = 1., a = 1.01 * g / mole,
+                          density = universe_mean_density, kStateGas,
+                          2.73 * kelvin, 3.e-18 * pascal);
+
+  // Quartz Material (SiO2)
+  SiO2 = new G4Material("quartz", density = 2.200 * g / cm3, ncomponents = 2);
+  SiO2->AddElement(Si, natoms = 1);
+  SiO2->AddElement(O, natoms = 2);
+
+  //
+  // Generate and Add Material Properties Table
+  //
+  const G4int num = 36;
+  G4double WaveLength[num];
+  G4double AirAbsorption[num];
+  G4double AirRefractiveIndex[num];
+  G4double PhotonEnergy[num];
+
+  // Absorption of quartz per 1m
+  G4double QuartzAbsorption[num] = {
+      0.999572036, 0.999544661, 0.999515062, 0.999483019, 0.999448285,
+      0.999410586, 0.999369611, 0.999325013, 0.999276402, 0.999223336,
+      0.999165317, 0.999101778, 0.999032079, 0.998955488, 0.998871172,
+      0.998778177, 0.99867541,  0.998561611, 0.998435332, 0.998294892,
+      0.998138345, 0.997963425, 0.997767484, 0.997547418, 0.99729958,
+      0.99701966,  0.99670255,  0.996342167, 0.995931242, 0.995461041,
+      0.994921022, 0.994298396, 0.993577567, 0.992739402, 0.991760297,
+      0.990610945};
+
+  for (int i = 0; i < num; i++) {
+    WaveLength[i] = (300 + i * 10) * nanometer;
+    AirAbsorption[i] = 10. * cm;  // If photon hits air, kill it
+    AirRefractiveIndex[i] = 1.;   // Rough air refraction
+    PhotonEnergy[num - (i + 1)] = twopi * hbarc / WaveLength[i];
+    /* Absorption is given per length and G4 needs mean free path
+     length, calculate it here
+     mean free path length - taken as probablility equal 1/e
+     that the photon will be absorbed */
+    QuartzAbsorption[i] = (-1) / log(QuartzAbsorption[i]) * 100 * cm;
+    // EpotekAbsorption[i] = (-1)/log(EpotekAbsorption[i])*
+    // epotekBarJoint.thickness;
+  }
+
+  G4double QuartzRefractiveIndex[num] = {
+      1.456535, 1.456812, 1.4571,   1.457399, 1.457712, 1.458038,
+      1.458378, 1.458735, 1.459108, 1.4595,   1.459911, 1.460344,
+      1.460799, 1.46128,  1.461789, 1.462326, 1.462897, 1.463502,
+      1.464146, 1.464833, 1.465566, 1.46635,  1.46719,  1.468094,
+      1.469066, 1.470116, 1.471252, 1.472485, 1.473826, 1.475289,
+      1.476891, 1.478651, 1.480592, 1.482739, 1.485127, 1.487793};
+
+  // Assign absorption and refraction to materials
+
+  // Quartz
+  G4MaterialPropertiesTable *QuartzMPT = new G4MaterialPropertiesTable();
+  QuartzMPT->AddProperty("RINDEX", PhotonEnergy, QuartzRefractiveIndex, num);
+  QuartzMPT->AddProperty("ABSLENGTH", PhotonEnergy, QuartzAbsorption, num);
+
+  SiO2->SetMaterialPropertiesTable(QuartzMPT);
+
+  // Air
+  G4MaterialPropertiesTable *AirMPT = new G4MaterialPropertiesTable();
+  AirMPT->AddProperty("RINDEX", PhotonEnergy, AirRefractiveIndex, num);
+  AirMPT->AddProperty("ABSLENGTH", PhotonEnergy, AirAbsorption, num);
+
+  // Assign these properties to the world volume
+  Air->SetMaterialPropertiesTable(AirMPT);
+  // In our rough assumption
+  Vacuum->SetMaterialPropertiesTable(AirMPT);
+  return sc;
+}
+
+StatusCode AddLumiDetectorTool::process(const std::string &) const {
+  G4LogicalVolume *worldLogical =
+      G4LogicalVolumeStore::GetInstance()->GetVolume(m_worldName.value());
+
+  ///////////////////////////////////////////////////////////
+
+  // The solid to be extracted from VELO vessel upstream cap
+  // in order to avoid overlap with beampipe
+  G4VSolid *ExtSolid = new G4Tubs("ExtTube",                // name
+                                  0.,                       // inner radius
+                                  LConst::BPOuterRadius,    // outer radius
+                                  LConst::worldSizeZ / 2.,  // dZ/2
+                                  0,                        // theta start
+                                  twopi);                   // theta of sector
+
+  ////////////////////// Beampipe ////////////////////////////
+  // G4VSolid *BPSolid = new G4Tubs("BeamPipe",			// name
+  // LConst::BPInnerRadius,						// inner
+  // radius
+  // LConst::BPOuterRadius,						// outer
+  // radius (LConst::worldSizeZ/2. + LConst::BeamStart)/2.,  // dZ/2 0,
+  // // theta start
+  // twopi);										// theta of
+  // sector
+  // G4LogicalVolume *BPLogical = new G4LogicalVolume(BPSolid,
+  // BPMaterial,
+  //"BeamPipe");
+  // G4VPhysicalVolume *BPPhysical =  new G4PVPlacement(
+  // new G4RotationMatrix(),
+  // G4ThreeVector(0.,0., (- LConst::worldSizeZ/2. + LConst::BeamStart)/2.),
+  // BPLogical,
+  //"BeamPipe",
+  // worldLogical,
+  // false,
+  // 0);
+  ////////////////////////////////////////////////////////////
+
+  ////////////////////// VELO cap ////////////////////////////
+  // G4VSolid *VELOsphere = new G4Sphere("VELOsphere",
+  // LConst::sphereInnerR,
+  // LConst::sphereOuterR,
+  // 0,
+  // twopi, //LConst::sphereTheta*2.,
+  // 0,
+  // LConst::sphereTheta);
+  // G4SubtractionSolid *VELOsphereSolid = new G4SubtractionSolid("VELOsphere",
+  // VELOsphere, ExtSolid); G4LogicalVolume *VELOsphereLog = new
+  // G4LogicalVolume(VELOsphereSolid, INOX, "VELOsphere");
+  // G4RotationMatrix *Rm = new G4RotationMatrix();
+  // Rm->rotateX(pi);
+  // G4VPhysicalVolume *VELOspherePhys =  new G4PVPlacement(
+  // Rm,
+  // G4ThreeVector(0.,0., (LConst::sphereCenter)),
+  // VELOsphereLog,
+  //"VELOsphere",
+  // worldLogical,
+  // false,
+  // 0);
+  ////////////////////////////////////////////////////////////
+
+  //    G4VSolid *BPVSolid = new G4Tubs("BeamPipeVacuum",               // name
+  //            0.,                                                     // inner
+  //            radius
+  //            LConst::BPInnerRadius,                              	// outer
+  //            radius (LConst::worldSizeZ/2. + LConst::BeamStart)/2., // dZ/2
+  //            0,                                                      // theta
+  //            start twopi);                                                 //
+  //            theta of sector
+
+  //    G4LogicalVolume *BPVLogical = new G4LogicalVolume(BPVSolid,
+  //            Vacuum,
+  //            "BeamPipeVacuum");
+  //    G4VPhysicalVolume *BPVPhysical =  new G4PVPlacement(
+  //            new G4RotationMatrix(),
+  //            G4ThreeVector(0.,0.,(LConst::worldSizeZ/2. +
+  //            LConst::BeamStart)/2.), BPVLogical, "BeamPipe", worldLogical,
+  //            false,
+  //            0);
+
+  ////////////////////// OLD CONFIGURATION ////////////////////////////
+
+  ///////////////////////////////////////////////////////
+  G4VSolid *L1SolidPlane = new G4Box("L1Plane", 100 * cm, 100 * cm, 1 * mm);
+  G4SubtractionSolid *L1Solid =
+      new G4SubtractionSolid("L1Plane", L1SolidPlane, ExtSolid);
+  new G4LogicalVolume(L1Solid, Vacuum, "L1PlaneOuter");
+  //    G4VPhysicalVolume *L1PlanePhysOuter =  new G4PVPlacement(
+  //                new G4RotationMatrix(),
+  //                G4ThreeVector(0.,0.,LConst::L1pozZ),
+  //                L1PlaneLogOuter,
+  //                "L1PlaneOuter",
+  //                worldLogical,
+  //                false,
+  //                0);
+  ///////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////
+  G4VSolid *L1SolidIn =
+      new G4Tubs("L1Plane", 0., LConst::BPOuterRadius, 1 * mm, 0, twopi);
+  new G4LogicalVolume(L1SolidIn, Vacuum, "L1PlaneInner");
+  //        G4VPhysicalVolume *L1PlanePhysInner =  new G4PVPlacement(
+  //                    new G4RotationMatrix(),
+  //                    G4ThreeVector(0.,0.,LConst::L1pozZ),
+  //                    L1PlaneLogInner,
+  //                    "L1PlaneInner",
+  //                    worldLogical,
+  //                    false,
+  //                    0);
+  ////////////////////////////////////////////////////////
+
+  ////////////////////////////////////////////////////////
+  G4VSolid *L2SolidPlane = new G4Box("L2Plane", 100 * cm, 100 * cm, 1 * mm);
+  G4SubtractionSolid *L2Solid =
+      new G4SubtractionSolid("L2Plane", L2SolidPlane, ExtSolid);
+  new G4LogicalVolume(L2Solid, Vacuum, "L2PlaneOuter");
+  //            G4VPhysicalVolume *L2PlanePhysOuter =  new G4PVPlacement(
+  //                        new G4RotationMatrix(),
+  //                        G4ThreeVector(0.,0.,LConst::L2pozZ),
+  //                        L2PlaneLogOuter,
+  //                        "L2PlaneOuter",
+  //                        worldLogical,
+  //                        false,
+  //                        0);
+  ////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////
+  G4VSolid *L2SolidIn =
+      new G4Tubs("L2Plane", 0., LConst::BPOuterRadius, 1 * mm, 0, twopi);
+  new G4LogicalVolume(L2SolidIn, Vacuum, "L2PlaneInner");
+  //        G4VPhysicalVolume *L2PlanePhysInner =  new G4PVPlacement(
+  //                    new G4RotationMatrix(),
+  //                    G4ThreeVector(0.,0.,LConst::L2pozZ),
+  //                    L2PlaneLogInner,
+  //                    "L2PlaneInner",
+  //                    worldLogical,
+  //                    false,
+  //                    0);
+  ////////////////////////////////////////////////////////
+
+  /////////////////// END OF OLD CONFIGURATION ///////////////////////
+
+  G4ThreeVector *Ta = new G4ThreeVector(0., 0., 0.);
+  G4RotationMatrix *Ra = new G4RotationMatrix();
+
+  ////////////// Trapeze sectors and absorbers ///////////////
+  G4Trd *secIn = new G4Trd("sectorIn", sectorIn.shortSide / 2.,
+                           sectorIn.longSide / 2., sectorIn.thickness / 2.,
+                           sectorIn.thickness / 2., sectorIn.height / 2.);
+
+  G4Trd *secOut = new G4Trd("sectorOut", sectorOut.shortSide / 2.,
+                            sectorOut.longSide / 2., sectorOut.thickness / 2.,
+                            sectorOut.thickness / 2., sectorOut.height / 2.);
+
+  //G4Trd *absIn = new G4Trd("absIn", absorberIn.shortSide / 2.,
+                           //absorberIn.longSide / 2., absorberIn.thickness / 2.,
+                           //absorberIn.thickness / 2., absorberIn.height / 2.);
+
+  G4Trd *absOut =
+      new G4Trd("absOut", absorberOut.shortSide / 2. * 1.3,
+                absorberOut.longSide / 2. * 1.3, absorberOut.thickness / 2.,
+                absorberOut.thickness / 2., absorberOut.height / 2.);
+  ////////////////////////////////////////////////////////////
+
+  ///////////// Photon detector at the surface ///////////////
+  G4VSolid *detectorOut = new G4Box("detector", sectorOut.longSide / 2.,
+                                    sectorOut.thickness / 2., 1 * mm);
+  ////////////////////////////////////////////////////////////
+
+  // Loop for sectors in order to place them with detectors and absorbers
+  // IN THE OLD CONFIGURATION (placing is commented)
+  G4LogicalVolume *LSectorIn[LConst::nSecIn];
+  for (int j = 0; j < LConst::nSecIn; ++j) {
+    /////////// sector /////////////
+    G4String name = "sector in ";
+    name += std::to_string(j + 1);
+    LSectorIn[j] = new G4LogicalVolume(secIn,
+                                       /*Vacuum*/ SiO2, name);
+    // FIXME: ADD SENSDET ! LSectorIn[j]->SetSensitiveDetector(LSD);
+    Ta = new G4ThreeVector(0., 0., 0.);
+    Ra = new G4RotationMatrix();
+
+    Ra->rotateX(-90. * deg);
+    Ra->rotateY(-360. / LConst::nSecIn * j * deg - 90. * deg);
+    Ta->setX(LConst::centerRadIn * TMath::Cos(360. / LConst::nSecIn * j * deg));
+    Ta->setZ(LConst::L1pozZ);
+    Ta->setY(LConst::centerRadIn * TMath::Sin(360. / LConst::nSecIn * j * deg));
+
+    //        G4VPhysicalVolume *PSecIn =  new G4PVPlacement(
+    //                    Ra,
+    //                    *Ta,
+    //                    LSectorIn[j],
+    //                    name,
+    //                    worldLogical,
+    //                    false,
+    //                    0);
+  }
+
+  G4RotationMatrix RTilt = G4RotationMatrix();
+  RTilt.rotateX(LConst::angleOut);
+
+  G4Transform3D Tr;
+
+  // Assembly
+  G4AssemblyVolume *assembly = new G4AssemblyVolume();
+  G4String name;
+  G4LogicalVolume *LSectorOut[LConst::nSecOut];
+
+  G4LogicalVolume *LAbsOut[LConst::nSecOut];
+  G4LogicalVolume *LDetectorOut[LConst::nSecOut];
+
+  // Loop for sectors in order to place them with detectors and absorbers
+  for (int j = 0; j < LConst::nSecOut; ++j) {
+    /////////// sector /////////////
+    name = "sector out ";
+    name += std::to_string(j + 1);
+    LSectorOut[j] = new G4LogicalVolume(secOut,
+                                        /*Vacuum*/ SiO2, name);
+    // FIXME: ADD SENSDET ! LSectorOut[j]->SetSensitiveDetector(LSD);
+    Ta = new G4ThreeVector(0., 0., 0.);
+    Ra = new G4RotationMatrix();
+
+    //        Ra->rotateX(-90.*deg);
+    Ra->rotateY(-360. / LConst::nSecOut * j * deg + 90 * deg);
+    *Ra = *Ra * RTilt;
+
+    //        Ta = G4ThreeVector(0.,0.,0.);
+    //        Ra = G4RotationMatrix();
+
+    //        Ra.rotateY(- 360./fTOFConst::nSec*i *deg + 90.*deg);
+
+    //        Ra = Ra * RTilt;
+
+    //        Ta.setX(fTOFConst::centerRad * TMath::Cos(360./fTOFConst::nSec*i
+    //        *deg)); Ta.setY(dist); Ta.setZ(fTOFConst::centerRad *
+    //        TMath::Sin(360./fTOFConst::nSec*i *deg));
+
+    //        Tr = G4Transform3D(Ra,Ta);
+    //        secAssembly->AddPlacedVolume(fullBarLog,Tr);
+
+    Ta->setX(LConst::centerRadOut *
+             TMath::Cos(360. / LConst::nSecOut * j * deg));
+    Ta->setY(LConst::L1pozZ);
+    Ta->setZ(LConst::centerRadOut *
+             TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    Tr = G4Transform3D(*Ra, *Ta);
+    //        if (j == 0)
+    assembly->AddPlacedVolume(LSectorOut[j], Tr);
+
+    //        G4VPhysicalVolume *PSecOut =  new G4PVPlacement(
+    //                    Ra,
+    //                    *Ta,
+    //                    LSectorOut[j],
+    //                    name,
+    //                    worldLogical,
+    //                    false,
+    //                    0);
+
+    ////////// absorber /////////////
+
+    name = "absorber out ";
+    name += std::to_string(j + 1);
+
+    Ta = new G4ThreeVector(0., 0., 0.);
+    Ra = new G4RotationMatrix();
+
+    Ra->rotateY(-360. / LConst::nSecOut * (j + 0.5) * deg + 90. * deg);
+
+    *Ra = *Ra * RTilt;
+    Ta->setX(LConst::centerRadOut *
+             TMath::Cos(360. / LConst::nSecOut * (j + 0.5) * deg));
+    Ta->setY(LConst::L1pozZ);
+    Ta->setZ(LConst::centerRadOut *
+             TMath::Sin(360. / LConst::nSecOut * (j + 0.5) * deg));
+
+    *Ta -= G4ThreeVector(
+        LConst::centerRadOut * TMath::Cos(360. / LConst::nSecOut * j * deg),
+        LConst::L1pozZ,
+        LConst::centerRadOut * TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    *Ta = (*Ra * (RTilt * (Ra->inverse() * (*Ta))));
+
+    *Ta += G4ThreeVector(
+        LConst::centerRadOut * TMath::Cos(360. / LConst::nSecOut * j * deg),
+        LConst::L1pozZ,
+        LConst::centerRadOut * TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    Tr = G4Transform3D(*Ra, *Ta);
+
+    LAbsOut[j] = new G4LogicalVolume(absOut,
+                                     /*Vacuum*/ SiO2, name);
+
+    //        if (j == 0 || j == LConst::nSecOut - 1)
+    assembly->AddPlacedVolume(LAbsOut[j], Tr);
+
+    /////////// outer detector ///////
+
+    name = "detector out ";
+    name += std::to_string(j + 1);
+
+    Ta = new G4ThreeVector(0., 0., 0.);
+    Ra = new G4RotationMatrix();
+
+    Ra->rotateY(-360. / LConst::nSecOut * j * deg + 90. * deg);
+
+    Ta->setX(
+        (LConst::detectorRadOut * TMath::Cos(TMath::Pi() / LConst::nSecOut) +
+         1 * mm) *
+        TMath::Cos(360. / LConst::nSecOut * j * deg));
+    Ta->setY(LConst::L1pozZ);
+    Ta->setZ(
+        (LConst::detectorRadOut * TMath::Cos(TMath::Pi() / LConst::nSecOut) +
+         1 * mm) *
+        TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    *Ta -= G4ThreeVector(
+        LConst::centerRadOut * TMath::Cos(360. / LConst::nSecOut * j * deg),
+        LConst::L1pozZ,
+        LConst::centerRadOut * TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    *Ta = (*Ra * (RTilt * (Ra->inverse() * (*Ta))));
+
+    *Ta += G4ThreeVector(
+        LConst::centerRadOut * TMath::Cos(360. / LConst::nSecOut * j * deg),
+        LConst::L1pozZ,
+        LConst::centerRadOut * TMath::Sin(360. / LConst::nSecOut * j * deg));
+
+    *Ra = *Ra * RTilt;
+    Tr = G4Transform3D(*Ra, *Ta);
+
+    LDetectorOut[j] = new G4LogicalVolume(detectorOut,
+                                          /*Vacuum*/ SiO2, name);
+    //        if (j == 0)
+    assembly->AddPlacedVolume(LDetectorOut[j], Tr);
+  }
+
+  Ra = new G4RotationMatrix();
+  Ta = new G4ThreeVector();
+
+  // Managing the final position of the assembly
+
+  Ra->rotateY(270.0 * deg);
+  Ra->rotateX(90.0 * deg);
+
+  Ta->setX(0.);
+  Ta->setY(0.);
+  Ta->setZ(0.);
+
+  //    Ta += G4ThreeVector(fTOFConst::centerRad *
+  //    TMath::Cos(360./fTOFConst::nSec*i *deg),
+  //                        0,
+  //                        fTOFConst::centerRad *
+  //                        TMath::Sin(360./fTOFConst::nSec*i *deg));
+
+  Ta->rotateZ(270 * deg);
+
+  Tr = G4Transform3D(*Ra, *Ta);
+
+  assembly->MakeImprint(worldLogical, Tr, 0, true);
+
+  const G4int num1 = 2;
+  G4double Ephoton[num1] = {1.5 * eV, 5.8 * eV};
+
+  G4OpticalSurface *OpVolumeKillSurface =
+      new G4OpticalSurface("VolumeKillSurface");
+  OpVolumeKillSurface->SetType(dielectric_metal);
+  OpVolumeKillSurface->SetFinish(polished);
+  OpVolumeKillSurface->SetModel(glisur);
+
+  G4double ReflectivityKill[num1] = {0., 0.};
+  G4double EfficiencyKill[num1] = {1., 1.};
+  G4MaterialPropertiesTable *VolumeKill = new G4MaterialPropertiesTable();
+  VolumeKill->AddProperty("REFLECTIVITY", Ephoton, ReflectivityKill, num1);
+  VolumeKill->AddProperty("EFFICIENCY", Ephoton, EfficiencyKill, num1);
+  OpVolumeKillSurface->SetMaterialPropertiesTable(VolumeKill);
+
+  G4OpticalSurface *quartzSurface = new G4OpticalSurface("quartzBorder");
+  quartzSurface->SetType(dielectric_dielectric);
+
+  for (int j = 0; j < LConst::nSecOut; ++j) {
+    new G4LogicalSkinSurface("AbsTrdSurface", LAbsOut[j], OpVolumeKillSurface);
+    new G4LogicalSkinSurface("DetectorAbsSurface", LDetectorOut[j],
+                             OpVolumeKillSurface);
+    new G4LogicalSkinSurface("sectorSurface", LSectorOut[j], quartzSurface);
+  }
+
+  G4Color green = G4Color(0., 1., 0.);
+
+  G4VisAttributes *sectorVisAtt = new G4VisAttributes;
+  sectorVisAtt->SetColor(green);
+  sectorVisAtt->SetVisibility(true);
+  for (int j = 0; j < LConst::nSecOut; ++j) {
+    LSectorOut[j]->SetVisAttributes(sectorVisAtt);
+  }
+  for (int j = 0; j < LConst::nSecIn; ++j) {
+    LSectorIn[j]->SetVisAttributes(sectorVisAtt);
+  }
+
+  return StatusCode::SUCCESS;
+}
diff --git a/Example/LHCbLumi/src/AddLumiDetectorTool.h b/Example/LHCbLumi/src/AddLumiDetectorTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c80bf9da6fcbac31f8c3d36ca10b05425319123
--- /dev/null
+++ b/Example/LHCbLumi/src/AddLumiDetectorTool.h
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "GaudiAlg/GaudiTool.h"
+#include "Geant4/G4AssemblyVolume.hh"
+#include "Geant4/G4Box.hh"
+#include "Geant4/G4Color.hh"
+#include "Geant4/G4ExtrudedSolid.hh"
+#include "Geant4/G4LogicalSkinSurface.hh"
+#include "Geant4/G4LogicalVolume.hh"
+#include "Geant4/G4Material.hh"
+#include "Geant4/G4MultiUnion.hh"
+#include "Geant4/G4NistManager.hh"
+#include "Geant4/G4OpticalSurface.hh"
+#include "Geant4/G4PVPlacement.hh"
+#include "Geant4/G4RotationMatrix.hh"
+#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4Sphere.hh"
+#include "Geant4/G4SubtractionSolid.hh"
+#include "Geant4/G4ThreeVector.hh"
+#include "Geant4/G4Transform3D.hh"
+#include "Geant4/G4Trap.hh"
+#include "Geant4/G4Trd.hh"
+#include "Geant4/G4Tubs.hh"
+#include "Geant4/G4TwoVector.hh"
+#include "Geant4/G4UnionSolid.hh"
+#include "Geant4/G4VSolid.hh"
+#include "Geant4/G4VisAttributes.hh"
+#include "Geant4/globals.hh"
+#include "SimInterfaces/IGaussinoTool.h"
+
+#include "LConst.hh"
+
+#include "LumiVolumeStructures.h"
+
+class AddLumiDetectorTool : public extends<GaudiTool, IGaussinoTool> {
+  public:
+  using extends::extends;
+
+  public:
+  StatusCode initialize() override;
+  StatusCode process(const std::string &parameter = "") const override;
+
+  private:
+  Gaudi::Property<std::string> m_worldName{this, "WorldName", "World"};
+  G4Material *worldMaterial;
+  G4Material *ScintMaterial;
+  G4Material *Vacuum;
+  G4Material *BPMaterial;
+  G4Material *INOX;
+  G4Material *SiO2;
+  G4Material *Copper;
+  G4Material *Beryllium;
+
+  G4Material *Air;
+
+  TrapezeSectorStructIn sectorIn;
+  TrapezeSectorStructOut sectorOut;
+  TrapezeAbsStructIn absorberIn;
+  TrapezeAbsStructOut absorberOut;
+};
diff --git a/Example/LHCbLumi/src/HitDataStructure.hh b/Example/LHCbLumi/src/HitDataStructure.hh
new file mode 100644
index 0000000000000000000000000000000000000000..02df937592411f7863ea024f1c702b610768f35e
--- /dev/null
+++ b/Example/LHCbLumi/src/HitDataStructure.hh
@@ -0,0 +1,23 @@
+#ifndef HitDataStructure_h
+#define HitDataStructure_h 1
+
+#include "Geant4/globals.hh"
+
+struct HitData
+{
+  G4int TrackID;
+  G4int ParentID;
+  G4int PdgID;
+  G4int StationID;
+  G4double Energy;
+  G4double Time;
+  G4double X;
+  G4double Y;
+  G4double Z;
+  G4double Px;
+  G4double Py;
+  G4double Pz;
+  G4double Momentum;
+};
+
+#endif
diff --git a/Example/LHCbLumi/src/LConst.hh b/Example/LHCbLumi/src/LConst.hh
new file mode 100644
index 0000000000000000000000000000000000000000..599cbfe5465b4127301c1f1b0bb83088efa6ce01
--- /dev/null
+++ b/Example/LHCbLumi/src/LConst.hh
@@ -0,0 +1,135 @@
+/*
+ * LConst.hh
+ *
+ *  Created on: Oct 2, 2018
+ *      Author: vsevolod
+ */
+
+#pragma once
+
+#include "TMath.h"
+#include "Geant4/G4SystemOfUnits.hh"
+#include "Geant4/G4PhysicalConstants.hh"
+#include "Geant4/globals.hh"
+
+namespace LConst{
+
+// World size
+const G4double worldSizeX = 1*m;
+const G4double worldSizeY = 1*m;
+const G4double worldSizeZ = 4.6*m;
+
+
+// Outer and inner radius of the beampipe
+//const G4double BPOuterRadius = 31*mm;
+//const G4double BPInnerRadius = 30*mm;
+const G4double BPOuterRadius = 41*mm;
+const G4double BPInnerRadius = 40*mm;
+
+
+// Detector pozition along Z-axis
+
+const G4double L1pozZ = - 2172.*mm;           // The closest option
+//const G4double L1pozZ = - 2172.*mm + 400*mm;  // An intermediate option
+//const G4double L1pozZ = - 2172.*mm + 800*mm;    // The farthest option
+
+// The same for the second detector
+//const G4double L2pozZ = - 2172.*mm + 800*mm;
+
+
+// VELO Sphere
+const G4double capHeight = 280.*mm;
+const G4double capBaseR = 1000./2. *mm;
+const G4double sphereStart = - 500.*mm;
+const G4double sphereThickness = 5.*mm;
+
+const G4double sphereR = (capHeight*capHeight + capBaseR*capBaseR)/2. / capHeight;
+const G4double sphereTheta = TMath::ATan(capBaseR/2. / (sphereR - capHeight));
+const G4double sphereOuterR = sphereR;
+const G4double sphereInnerR = sphereR - sphereThickness;
+const G4double sphereCenter = sphereStart - capHeight + sphereR;
+
+const G4double BeamStart = sphereStart - capHeight + 32.*mm;
+
+const G4double VeloLeft = -175*mm;
+const G4double VeloRight = 350*mm;
+
+
+
+///////////////////////// Detector inside beampipe ///////////////////////////////////////////////////
+// The old configuration
+
+const G4double sectorThicknessIn = 1*cm;
+
+const G4double innerRadIn = 10*mm;
+const G4double outerRadIn = BPInnerRadius;
+const G4int nSecIn = 12;
+
+const G4double centerRadIn = (innerRadIn * TMath::Cos(TMath::Pi() / nSecIn) +
+                              outerRadIn * TMath::Cos(TMath::Pi() / nSecIn)) / 2.;
+const G4double absInnerSideIn = 0.1*mm;
+const G4double absOuterSideIn = absInnerSideIn * outerRadIn / innerRadIn;
+const G4double VertHeightIn = outerRadIn - innerRadIn;
+const G4double innerSideIn = 2. * innerRadIn * TMath::Sin(TMath::Pi() / nSecIn) - absInnerSideIn;
+const G4double outerSideIn = 2. * outerRadIn * TMath::Sin(TMath::Pi() / nSecIn) - absOuterSideIn;
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////// Detoctor outside beampipe ///////////////////////////////////////////////
+const G4double sectorThicknessOut = 1*cm;
+
+const G4double innerRadOut = BPOuterRadius + 1.*cm;
+
+const G4double lengthOut = 60*mm;
+//const G4double outerRadOut = 10*cm;
+
+const G4int nSecOut = 100;
+
+/*
+ * Saturated track angles in quartz:    46.64 - 47.77
+ * Green light saturated track angle:   46.95
+ *
+ * Lower angle is the angle of the detector inner radius
+*/
+
+const G4double saturatedAngle = 46.95*deg;
+const G4double lowerAngle = atan( - (innerRadOut + lengthOut / sqrt(2) * 0.1) / L1pozZ);
+
+const G4double angleOut = saturatedAngle + lowerAngle;
+
+const G4double centerRadOut = innerRadOut + lengthOut * cos(angleOut) / 2.;
+const G4double outerRadOut = innerRadOut + lengthOut;
+
+const G4double detectorRadOut = centerRadOut + lengthOut / 2.;
+
+//const G4double centerRadOut = (innerRadOut * TMath::Cos(TMath::Pi() / nSecOut) +
+//                               outerRadOut * TMath::Cos(TMath::Pi() / nSecOut)) / 2.;
+
+const G4double absInnerSideOut = 0.01*mm;
+const G4double absOuterSideOut = absInnerSideOut * outerRadOut / innerRadOut * 0.8;
+const G4double VertHeightOut = outerRadOut - innerRadOut;
+
+const G4double innerSideOut = 2. * (centerRadOut - VertHeightOut * TMath::Cos(angleOut)/2.) * TMath::Sin(TMath::Pi() / nSecOut) - absInnerSideOut*40;
+const G4double outerSideOut = 2. * (centerRadOut + VertHeightOut * TMath::Cos(angleOut)/2.) * TMath::Sin(TMath::Pi() / nSecOut) - absOuterSideOut*20;
+
+//const G4double outerSideOut = innerSideOut;
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+///////////////////////////////////////// Vertex /////////////////////////////////////////////////////////
+const G4double VertexX = 0.;
+const G4double VertexY = 0.;
+const G4double VertexZ = 0.;
+
+
+const G4double VertexSigmaX = 0.;
+const G4double VertexSigmaY = 0.;
+const G4double VertexSigmaZ = 1.*cm;
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+}
+
diff --git a/Example/LHCbLumi/src/LumiHit.cpp b/Example/LHCbLumi/src/LumiHit.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a79fb9df42afd3ae8eff44d15ea08decb2d6cc6
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiHit.cpp
@@ -0,0 +1,40 @@
+/*
+ * LumiHit.cpp
+ *
+ *  Created on: Oct 3, 2018
+ *      Author: vsevolod
+ */
+
+#include "LumiHit.h"
+
+#include "Geant4/G4Circle.hh"
+#include "Geant4/G4Color.hh"
+#include "Geant4/G4Square.hh"
+#include "Geant4/G4UnitsTable.hh"
+#include "Geant4/G4VVisManager.hh"
+#include "Geant4/G4VisAttributes.hh"
+
+G4ThreadLocal G4Allocator<LumiHit>* aLumiHitAllocator = nullptr;
+
+LumiHit::LumiHit()  {
+  for (G4int i = 0; i < LConst::nSecOut; ++i) {
+    _nPhot[i] = 0;
+  }
+}
+
+LumiHit::LumiHit(const LumiHit& right) {
+  for (G4int i = 0; i < LConst::nSecOut; ++i) {
+    _nPhot[i] = right._nPhot[i];
+  }
+}
+
+const LumiHit& LumiHit::operator=(const LumiHit& right) {
+  for (G4int i = 0; i < LConst::nSecOut; ++i) {
+    _nPhot[i] = right._nPhot[i];
+  }
+  return *this;
+}
+
+G4int LumiHit::operator==(const LumiHit& right) const {
+  return (this == &right) ? 1 : 0;
+}
diff --git a/Example/LHCbLumi/src/LumiHit.h b/Example/LHCbLumi/src/LumiHit.h
new file mode 100644
index 0000000000000000000000000000000000000000..88745225fb4f2ffb1b60aeeafb83db8490fa31a7
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiHit.h
@@ -0,0 +1,50 @@
+/*
+ * LumiHit.h
+ *
+ *  Created on: Oct 3, 2018
+ *      Author: vsevolod
+ */
+
+#pragma once
+
+#include "Geant4/G4VHit.hh"
+// G4
+#include "Geant4/G4Allocator.hh"
+#include "Geant4/G4THitsCollection.hh"
+#include "Geant4/G4ThreeVector.hh"
+#include "LConst.hh"
+
+// my
+#include "HitDataStructure.hh"
+
+class LumiHit : public G4VHit {
+  public:
+    LumiHit();
+
+  LumiHit(const LumiHit&);
+  const LumiHit& operator=(const LumiHit&);
+  G4int operator==(const LumiHit&) const;
+
+  inline void* operator new(size_t);
+  inline void operator delete(void*);
+  inline void InsertPhoton(G4int secID){ _nPhot[secID - 1] ++; }
+  inline G4int GetNPhotons(G4int secID) const { return _nPhot[secID - 1]; }
+
+  private:
+    G4int _nPhot[LConst::nSecOut];
+};
+
+typedef G4THitsCollection<LumiHit> LumiHitsCollection;
+
+extern G4ThreadLocal G4Allocator<LumiHit>* aLumiHitAllocator;
+
+inline void* LumiHit::operator new(size_t) {
+  if (!aLumiHitAllocator) {
+    aLumiHitAllocator = new G4Allocator<LumiHit>;
+  }
+  return (void*)aLumiHitAllocator->MallocSingle();
+}
+
+inline void LumiHit::operator delete(void* aHit) {
+  aLumiHitAllocator->FreeSingle((LumiHit*)aHit);
+}
diff --git a/Example/LHCbLumi/src/LumiSensitiveDetector.cpp b/Example/LHCbLumi/src/LumiSensitiveDetector.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c660b5ac56667bc5aca077d688fa8f23f084da49
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiSensitiveDetector.cpp
@@ -0,0 +1,112 @@
+/*
+ * LumiSensitiveDetector.cpp
+ *
+ *  Created on: Oct 3, 2018
+ *      Author: vsevolod
+ */
+
+#include "LumiSensitiveDetector.h"
+
+#include "Geant4/G4HCofThisEvent.hh"
+#include "Geant4/G4PhysicalConstants.hh"
+#include "Geant4/G4RunManager.hh"
+#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4SystemOfUnits.hh"
+
+#include <iterator>
+
+LumiSensitiveDetector::LumiSensitiveDetector(G4String name)
+    :  // @suppress("Class members should be properly initialized")
+      G4VSensitiveDetector(name) {
+  //  G4RunManager* runManager = G4RunManager::GetRunManager();
+  collectionName.insert("Hits");
+}
+
+LumiSensitiveDetector::~LumiSensitiveDetector() {}
+
+void LumiSensitiveDetector::Initialize(G4HCofThisEvent* HCE) {
+  _Collection =
+      new LumiHitsCollection(SensitiveDetectorName, collectionName[0]);
+
+  std::string hit_location = SensitiveDetectorName + "/" + collectionName[0];
+
+  debug("Registering location at " + hit_location);
+  int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(hit_location);
+
+  HCE->AddHitsCollection(HCID, _Collection);
+
+  _theHit = new LumiHit();
+  _Collection->insert(_theHit);
+}
+
+G4bool LumiSensitiveDetector::ProcessHitsL(G4Step* aStep,
+                                           G4TouchableHistory* hist) {
+  return ProcessHits(aStep, hist);
+}
+
+G4bool LumiSensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
+  G4Track* aTrack = aStep->GetTrack();
+  G4ThreeVector globalPosition = aStep->GetPostStepPoint()->GetPosition();
+  //	newHit->myData;
+
+  G4StepPoint* aPostPoint = aStep->GetPostStepPoint();
+  G4StepPoint* aPrevPoint = aStep->GetPreStepPoint();
+  if (!aPostPoint->GetPhysicalVolume()) return false;
+
+  G4LogicalVolume* PostVolume =
+      aPostPoint->GetPhysicalVolume()->GetLogicalVolume();
+  G4LogicalVolume* PrevVolume =
+      aPrevPoint->GetPhysicalVolume()->GetLogicalVolume();
+
+  G4String PreName = PrevVolume->GetName();
+  G4String PostName = PostVolume->GetName();
+
+  const G4DynamicParticle* aParticle = aTrack->GetDynamicParticle();
+  if (printDebug()) {
+    std::stringstream sstr;
+    sstr << "SD hit by " << aParticle->GetDefinition()->GetParticleName();
+    debug(sstr.str());
+  }
+
+  // Handling only optical photons
+  if (aParticle->GetDefinition()->GetParticleName() != "opticalphoton")
+    return false;
+
+  // Vectors of sector's and detector's names splitted into words
+  std::vector<G4String> sectorWords;
+  std::vector<G4String> detectorWords;
+
+  auto splitName = [](auto& str, auto& cont) {
+    std::istringstream iss(str);
+    std::copy(std::istream_iterator<std::string>(iss),
+              std::istream_iterator<std::string>(), std::back_inserter(cont));
+  };
+
+  // Splitting a string into words
+  splitName(PreName, sectorWords);
+  splitName(PostName, detectorWords);
+  if (printDebug()) {
+    std::stringstream sstr;
+    sstr << "sectorWords " << sectorWords[0];
+    debug(sstr.str());
+    sstr.clear();
+    sstr << "detectorWords " << detectorWords[0] << " -> " << detectorWords[0];
+    debug(sstr.str());
+  }
+
+  // Sector ID discrimination for the hit
+  if (sectorWords[0] == "sector" && detectorWords[0] == "detector") {
+    G4int stationID = atoi(detectorWords[2]);
+    _theHit->InsertPhoton(stationID);
+  } else
+    return false;
+
+  return true;
+}
+
+#include "GiGaMTFactories/GiGaMTG4SensDetFactory.h"
+
+// As long we do not have any additional
+typedef GiGaMTG4SensDetFactory<LumiSensitiveDetector> LumiSensitiveDetectorFAC;
+
+DECLARE_COMPONENT_WITH_ID(LumiSensitiveDetectorFAC, "LumiSensitiveDetector")
diff --git a/Example/LHCbLumi/src/LumiSensitiveDetector.h b/Example/LHCbLumi/src/LumiSensitiveDetector.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e8f17b4491ed1c2a92d1e8b7551652e5726b995
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiSensitiveDetector.h
@@ -0,0 +1,25 @@
+#pragma once
+#include "Geant4/G4VSensitiveDetector.hh"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
+#include "HitDataStructure.hh"
+#include "LumiHit.h"
+
+class G4HCofThisEvent;
+class G4Step;
+class G4TouchableHistory;
+
+class LumiSensitiveDetector : public G4VSensitiveDetector, public virtual GiGaMessage {
+  public:
+  LumiSensitiveDetector(G4String name);
+  virtual ~LumiSensitiveDetector();
+
+  void Initialize(G4HCofThisEvent*) override;
+
+  G4bool ProcessHits(G4Step*, G4TouchableHistory*) override;
+
+  G4bool ProcessHitsL(G4Step*, G4TouchableHistory*);
+
+  private:
+  LumiHitsCollection* _Collection{nullptr};
+  LumiHit* _theHit{nullptr};
+};
diff --git a/Example/LHCbLumi/src/LumiSteppingAction.cpp b/Example/LHCbLumi/src/LumiSteppingAction.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..52849527059af56f88bc91a22ab92881d9694e1d
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiSteppingAction.cpp
@@ -0,0 +1,193 @@
+/*
+ * LumiSteppingAction.cpp
+ *
+ *  Created on: Oct 2, 2018
+ *      Author: vsevolod
+ */
+
+#include "LumiSteppingAction.h"
+#include "LumiSensitiveDetector.h"
+#include "Geant4/G4Track.hh"
+#include "Geant4/G4ParticleTypes.hh"
+#include "Geant4/G4ParticleDefinition.hh"
+#include "Geant4/G4OpBoundaryProcess.hh"
+#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4ProcessManager.hh"
+#include "Geant4/G4SystemOfUnits.hh"
+#include "Geant4/G4PhysicalConstants.hh"
+#include "Geant4/G4EventManager.hh"
+#include "Geant4/G4Event.hh"
+
+
+void LumiSteppingAction::UserSteppingAction(const G4Step* aStep) {
+    //	G4cout << "_____________________________ step" << G4endl;
+    G4Track* aTrack = aStep->GetTrack();
+    // G4Track *aTrack = aStep->GetTrack();
+    G4int trackID = aTrack->GetTrackID();
+    //G4cout<<"trackID = "<<trackID<<G4endl;
+
+
+    // Pre step point and physical volume
+    G4StepPoint* aPrePoint = aStep->GetPreStepPoint();
+    //G4VPhysicalVolume* aPrePV = aPrePoint->GetPhysicalVolume();
+
+    // Post step point and physical volume
+    G4StepPoint* aPostPoint = aStep->GetPostStepPoint();
+    G4VPhysicalVolume* aPostPV = aPostPoint->GetPhysicalVolume();
+
+
+    // Further operations are only for optical photons
+    G4ParticleDefinition* particleType = aTrack->GetDefinition();
+    if (particleType != G4OpticalPhoton::OpticalPhotonDefinition())
+        return;
+
+    // Check if particle trying to escape the World
+    if (!aPostPV) return;
+
+    // TO BE REVIEWED, GONNA BE A MISTAKE HERE///////////////////////////////
+//    if(!aPostPV->GetLogicalVolume()->GetSensitiveDetector()) return;
+    ////////////////////////////////////////////////////////////////////////
+
+    // Killing downstream particles
+    if (aPrePoint->GetPosition().z() > 50.*cm) {
+        aTrack->SetTrackStatus(fStopAndKill);
+        return;
+    }
+
+    // Killing charged particles bellow 20 MeV
+    if (aPrePoint->GetCharge() != 0. && aPrePoint->GetMomentum().mag() < 20.*MeV ) {
+        aTrack->SetTrackStatus(fStopAndKill);
+        return;
+    }
+
+    static thread_local double _probOfReflection = 1.;
+    static thread_local int _particleID = 0;
+    static thread_local int _eventID = 0;
+    int currentid = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
+
+    // Getting probability of internal reflection
+    if (_particleID != trackID || currentid != _eventID) {
+        _probOfReflection = 1.;
+        _particleID = trackID;
+        _eventID = currentid;
+        InternalReflectionProbability(aTrack->GetTotalEnergy()/eV,
+                                      _probOfReflection);
+    }
+
+    // Declaring boundary
+    G4OpBoundaryProcessStatus boundaryStatus = Undefined;
+    static G4OpBoundaryProcess* boundary = NULL;
+
+    // Find boundary process
+    if (!boundary) {
+        G4ProcessManager* pm =
+                aStep->GetTrack()->GetDefinition()->GetProcessManager();
+        G4int nprocesses = pm->GetProcessListLength();
+        G4ProcessVector* pv = pm->GetProcessList();
+        for (G4int i = 0; i < nprocesses; i++) {
+            if ((*pv)[i]->GetProcessName() == "OpBoundary") {
+                boundary = (G4OpBoundaryProcess*)(*pv)[i];
+                break;
+            }
+        }
+    }
+
+    // Only boundary processes are handling further
+    if (!boundary) return;
+
+    boundaryStatus = boundary->GetStatus();
+
+    if (aPostPoint->GetStepStatus() == fGeomBoundary) {
+        G4double flat = G4UniformRand();
+        switch(boundaryStatus) {
+        case Absorption:
+            break;
+        case FresnelReflection:
+            // Reflections of surfaces of different media
+            break;
+        case TotalInternalReflection:
+            // Actually check if particle is reflected
+            if (flat > _probOfReflection) {
+                G4Track* aNonConstTrack = const_cast<G4Track*>(aTrack);
+                aNonConstTrack->SetTrackStatus(fStopAndKill);
+//                G4cout << "KILL THAT BASTARD \n";
+            }
+//            G4cout << "TOTAL INTERNAL REFLECTION"<< G4endl;
+            break;
+        case SpikeReflection:
+            break;
+        default:
+            break;
+
+        }
+
+    }
+
+
+    return;
+}
+
+// This metod is stolen from Leonid's code
+void LumiSteppingAction::InternalReflectionProbability(G4double energy,
+                                                     G4double& probability)
+{
+    probability = 1.0;
+
+    /* this function simulate the internal reflection probability per one
+     bounce - each time photon bounced this function is called
+     and the reflection is tested if photon reflects or disappear -
+     this function estimates loss of photons during imperfections
+     of bar */
+
+    static G4double opticalPhotonEnergy[36] = {
+        1.90744901082931,1.93725290162352,1.96800294768103,1.99974493070815,
+        2.03252763449025,2.06640309506508,2.10142687633737,2.13765837420526,
+        2.17516115270009,2.21400331614116,2.25425792188918,2.29600343896121,
+        2.33932425856425,2.38431126353664,2.43106246478245,2.4796837140781,
+        2.53028950416133,2.58300386883136,2.63796139795543,2.6953083848675,
+        2.75520412675345,2.81782240236148,2.88335315590477,2.95200442152155,
+        3.02400452936354,3.09960464259763,3.17908168471551,3.26274172905013,
+        3.35092393794338,3.44400515844181,3.54240530582586,3.64659369717368,
+        3.75709653648197,3.87450580324703,3.99948986141629,4.13280619013017};
+
+    static G4double internalReflectivity[36] = {
+        0.999895281,0.999891334,0.999885743,0.999878696,0.999870426,
+        0.9998612,0.999851309,0.999841055,0.999830735,0.999820635,0.999811012,
+        0.999802084,0.999794018,0.999786917,0.999780807,0.999775625,
+        0.999771209,0.999767282,0.999763441,0.999759146,0.999753706,
+        0.999746266,0.999735798,0.999721084,0.999700708,0.99967304,
+        0.999636227,0.999588178,0.999526552,0.999448747,0.999351887,
+        0.999232808,0.99908805,0.998913839,0.998706078,0.998460335};
+
+    G4int i;
+    for(i = 0; i < 36;i++) {
+        if(energy < opticalPhotonEnergy[i]) break;
+    }
+
+
+    probability = ((energy-opticalPhotonEnergy[i-1])/
+            (opticalPhotonEnergy[i]-opticalPhotonEnergy[i-1]))*
+            (internalReflectivity[i]-internalReflectivity[i-1]) +
+            internalReflectivity[i-1];
+
+    /* because the ratio between peak1 and peak2 did not correspond,
+     the reflection probability was change to get the same
+     ration 2.1:1 => the original probability is multiplied by .9992 */
+    probability = probability*.9992;
+
+
+    // probability = 0;
+}
+
+#include "GaudiAlg/GaudiTool.h"
+#include "GiGaMTFactories/GiGaFactoryBase.h"
+
+class LumiSteppingActionFAC : public extends<GaudiTool, GiGaFactoryBase<G4UserSteppingAction>>
+{
+  using extends::extends;
+  virtual G4UserSteppingAction* construct() const override {
+    return new LumiSteppingAction{};
+  }
+};
+
+DECLARE_COMPONENT_WITH_ID( LumiSteppingActionFAC, "LumiSteppingAction" )
diff --git a/Example/LHCbLumi/src/LumiSteppingAction.h b/Example/LHCbLumi/src/LumiSteppingAction.h
new file mode 100644
index 0000000000000000000000000000000000000000..1399f95ad588cacc45fa485fd36aa822d7e45a93
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiSteppingAction.h
@@ -0,0 +1,23 @@
+/*
+ * LumiSteppingAction.h
+ *
+ *  Created on: Oct 2, 2018
+ *      Author: vsevolod
+ */
+
+#pragma once
+
+#include "Geant4/G4UserSteppingAction.hh"
+#include "Geant4/globals.hh"
+
+class LumiSteppingAction: public G4UserSteppingAction {
+public:
+  LumiSteppingAction() = default;
+  virtual ~LumiSteppingAction() = default;
+	void UserSteppingAction(const G4Step*) override;
+
+private:
+
+    void InternalReflectionProbability(G4double energy,
+                                       G4double& probability);
+};
diff --git a/Example/LHCbLumi/src/LumiVolumeStructures.h b/Example/LHCbLumi/src/LumiVolumeStructures.h
new file mode 100644
index 0000000000000000000000000000000000000000..d338b38d1a20109282724d32544e51a520d04549
--- /dev/null
+++ b/Example/LHCbLumi/src/LumiVolumeStructures.h
@@ -0,0 +1,115 @@
+#pragma once
+
+//G4
+#include "Geant4/G4Material.hh"
+#include "Geant4/G4VSolid.hh"
+#include "Geant4/G4LogicalVolume.hh"
+#include "Geant4/G4VPhysicalVolume.hh"
+#include "Geant4/G4Point3D.hh"
+#include "Geant4/G4TwoVector.hh"
+#include "Geant4/globals.hh"
+
+#include "TMath.h"
+
+//My
+#include "LConst.hh"
+
+// Base structure
+struct VolumeStruct {
+    G4Material*        material;
+    G4VSolid*          solid;
+    G4LogicalVolume*   logical;
+    G4VPhysicalVolume* physical;
+    VolumeStruct() :
+        material(0),
+        solid(0),
+        logical(0),
+        physical(0)
+    {;}
+    ~VolumeStruct() {;}
+};
+
+// Sector structure (inside beampipe)
+struct TrapezeSectorStructIn: VolumeStruct {
+    const G4double thickness;
+    const G4double height;
+    const G4double shortSide;
+    const G4double longSide;
+    const G4double angle;
+    const G4double sides;
+    const G4double middleLine;
+    TrapezeSectorStructIn():
+        thickness(LConst::sectorThicknessIn),
+        height(LConst::outerRadIn * TMath::Cos(TMath::Pi() / LConst::nSecIn) -
+               LConst::innerRadIn * TMath::Cos(TMath::Pi() / LConst::nSecIn)),
+        shortSide(LConst::innerSideIn),
+        longSide(LConst::outerSideIn),
+        angle(atan((longSide-shortSide)/2./height)),
+        sides(sqrt(height*height + (longSide-shortSide)*(longSide-shortSide)/4.)),
+        middleLine((longSide+shortSide)/2.)
+    {;}
+};
+
+// Sector structure (outside beampipe)
+struct TrapezeSectorStructOut: VolumeStruct {
+    const G4double thickness;
+    const G4double height;
+    const G4double shortSide;
+    const G4double longSide;
+    const G4double angle;
+    const G4double sides;
+    const G4double middleLine;
+    TrapezeSectorStructOut():
+        thickness(LConst::sectorThicknessOut),
+        height(LConst::lengthOut),
+        shortSide(LConst::innerSideOut),
+        longSide(LConst::outerSideOut),
+        angle(atan((longSide-shortSide)/2./height)),
+        sides(sqrt(height*height + (longSide-shortSide)*(longSide-shortSide)/4.)),
+        middleLine((longSide+shortSide)/2.)
+    {
+    }
+};
+
+// Optical insulation between sectors (inside beampipe)
+struct TrapezeAbsStructIn: VolumeStruct {
+    const G4double shortSide;
+    const G4double longSide;
+    const G4double thickness;
+    const G4double height;
+    const G4double angle;
+    const G4double sides;
+    const G4double middleLine;
+    TrapezeAbsStructIn():
+        shortSide(LConst::absInnerSideIn),
+        longSide(LConst::absOuterSideIn),
+        thickness(LConst::sectorThicknessIn),
+        height(LConst::outerRadIn -
+               LConst::innerRadIn),
+        angle(atan((longSide-shortSide)/2./height)),
+        sides(sqrt(height*height + (longSide-shortSide)*(longSide-shortSide)/4.)),
+        middleLine((longSide+shortSide)/2.)
+    {;}
+};
+
+// Optical insulation between sectors (outside beampipe)
+struct TrapezeAbsStructOut: VolumeStruct {
+    const G4double shortSide;
+    const G4double longSide;
+    const G4double thickness;
+    const G4double height;
+    const G4double angle;
+    const G4double sides;
+    const G4double middleLine;
+    TrapezeAbsStructOut():
+        shortSide(LConst::absInnerSideOut),
+        longSide(LConst::absOuterSideOut),
+        thickness(LConst::sectorThicknessOut * 1.2),
+        height(LConst::lengthOut),
+        angle(atan((longSide-shortSide)/2./height)),
+        sides(sqrt(height*height + (longSide-shortSide)*(longSide-shortSide)/4.)),
+        middleLine((longSide+shortSide)/2.)
+    {;}
+};
+
+
diff --git a/Example/LHCbLumi/src/MakeLumiHitsTuple.cpp b/Example/LHCbLumi/src/MakeLumiHitsTuple.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..15e47e2f1426d8bcc0d5a6bf8940ba37a29c4a7a
--- /dev/null
+++ b/Example/LHCbLumi/src/MakeLumiHitsTuple.cpp
@@ -0,0 +1,89 @@
+// from Geant4
+#include "Geant4/G4HCofThisEvent.hh"
+#include "Geant4/G4SDManager.hh"
+
+// local
+#include "MakeLumiHitsTuple.h"
+#include "LumiHit.h"
+
+//-----------------------------------------------------------------------------
+// Implementation file for class : MakeLumiHitsTuple
+//
+// 2018-04-05 : Dominik Muller
+//-----------------------------------------------------------------------------
+
+// Declaration of the Algorithm Factory
+DECLARE_COMPONENT(MakeLumiHitsTuple)
+
+//=============================================================================
+// Initialization
+//=============================================================================
+StatusCode MakeLumiHitsTuple::initialize() {
+    StatusCode sc = Consumer::initialize();  // must be executed first
+    if (sc.isFailure()) return sc;  // error printed already by GaudiAlgorithm
+
+    debug() << "==> Initialize" << endmsg;
+
+    if ("" == m_colName) {
+        fatal() << "Property CollectionName need to be set! " << endmsg;
+        return StatusCode::FAILURE;
+    }
+    m_file = new TFile("LumiHits.root", "RECREATE");
+    m_tree = new TTree("Tree", "Tree");
+    _nSec = LConst::nSecOut;
+    m_tree->Branch("nSec", &_nSec, "nSec/I");
+    m_tree->Branch("nPhot", _nPhot, "nPhot[nSec]/I");
+    m_tree->SetDirectory(m_file);
+    m_tree->Write();
+
+    return StatusCode::SUCCESS;
+}
+
+StatusCode MakeLumiHitsTuple::finalize() {
+    m_file->cd();
+    m_tree->SetDirectory(m_file);
+    m_tree->Write();
+    m_file->Close();
+
+    return Consumer::finalize();  // must be executed first
+}
+
+//=============================================================================
+// Main execution
+//=============================================================================
+void MakeLumiHitsTuple::operator()(
+    const G4EventProxies& eventproxies,
+    const LinkedParticleMCParticleLinks& ) const {
+    debug() << "==> Execute" << endmsg;
+    std::lock_guard locked{m_lazy_lock};
+    m_tree->SetDirectory(m_file);
+
+    for(int idx=0;idx < LConst::nSecOut; idx++){
+      // FIXME: + 1 here necessary?
+      _nPhot[idx] = 0;
+    }
+    for (auto& ep : eventproxies) {
+        auto hitCollection =
+            ep.GetHitCollection<LumiHitsCollection>(m_colName);
+        if (!hitCollection) {
+            warning() << "The hit collection='" + m_colName + "' is not found!"
+                      << endmsg;
+            continue;
+        }
+        // reserve elements on output container
+        int numOfHits = hitCollection->entries();
+        if (numOfHits != 1) {
+            error() << "Number of LumiHits for G4Event is not exactly one!"
+                      << endmsg;
+            continue;
+        }
+        auto hit = (*hitCollection)[0];
+        for(int idx=0;idx < LConst::nSecOut; idx++){
+          // FIXME: + 1 here necessary?
+          _nPhot[idx] += hit->GetNPhotons(idx + 1);
+        }
+    }
+    m_file->cd();
+    m_tree->SetDirectory(m_file);
+    m_tree->Fill();
+}
diff --git a/Example/LHCbLumi/src/MakeLumiHitsTuple.h b/Example/LHCbLumi/src/MakeLumiHitsTuple.h
new file mode 100755
index 0000000000000000000000000000000000000000..657417270ae54099ef832990001f4e1fec884dc2
--- /dev/null
+++ b/Example/LHCbLumi/src/MakeLumiHitsTuple.h
@@ -0,0 +1,65 @@
+#pragma once
+#include <vector>
+
+// Include files
+// from Gaudi
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiAlg/Consumer.h"
+#include "GiGaMTCoreRun/G4EventProxy.h"
+#include "GiGaMTCoreTruth/MCTruthConverter.h"
+#include "MCTruthToEDM/LinkedParticleMCParticleLink.h"
+
+#include "Defaults/Locations.h"
+
+#include "LConst.hh"
+#include "TTree.h"
+#include "TFile.h"
+
+// Forward declarations
+class IGiGaSvc;
+class IGiGaKineCnvSvc;
+class DetectorElement;
+class TrackerHit;
+
+/** @class MakeLumiHitsTuple MakeLumiHitsTuple.h
+ *
+ *
+ *  @author Gloria CORTI
+ *  @date   2005-10-02
+ */
+class MakeLumiHitsTuple
+    : public Gaudi::Functional::Consumer<void(
+          const G4EventProxies&, const LinkedParticleMCParticleLinks&)> {
+  public:
+  /// Standard constructor
+  MakeLumiHitsTuple(const std::string& name, ISvcLocator* pSvcLocator)
+      : Consumer(
+            name, pSvcLocator,
+            {{KeyValue{"Input", Gaussino::G4EventsLocation::Default},
+              KeyValue{
+                  "LinkedParticleMCParticleLinks",
+                  Gaussino::LinkedParticleMCParticleLinksLocation::Default}}}) {}
+  virtual ~MakeLumiHitsTuple() = default;
+
+  virtual void operator()(const G4EventProxies&, const LinkedParticleMCParticleLinks&) const override;
+
+  virtual StatusCode initialize() override;  ///< Algorithm initialization
+  virtual StatusCode finalize() override;  ///< Algorithm initialization
+
+  private:
+
+  Gaudi::Property<std::string> m_colName{
+      this, "CollectionName", "",
+      "Name of Geant4 collection where to retrieve hits"};
+  Gaudi::Property<std::vector<std::string>> m_detName{
+      this,
+      "Detectors",
+      {},
+      "List of detector paths in TDS for which to retrieve the hits (most of "
+      "the time one"};
+  mutable std::mutex m_lazy_lock; 
+  G4int _nSec;
+  mutable G4int _nPhot[LConst::nSecOut];
+  mutable TTree* m_tree;
+  mutable TFile* m_file;
+};
diff --git a/Example/LHCbLumi/src/Physics.cpp b/Example/LHCbLumi/src/Physics.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..42fe9cc4b070d9c1a8b2e4211d9f153698293d61
--- /dev/null
+++ b/Example/LHCbLumi/src/Physics.cpp
@@ -0,0 +1,6 @@
+#include "GiGaMTFactories/GiGaMTG4PhysicsConstrFAC.h"
+
+#include "Geant4/G4OpticalPhysics.hh"
+
+typedef GiGaMTG4PhysicsConstrFAC<G4OpticalPhysics> GiGaMT_G4OpticalPhysics;
+DECLARE_COMPONENT_WITH_ID( GiGaMT_G4OpticalPhysics, "GiGaMT_G4OpticalPhysics" )
diff --git a/Gen/AmpGen/.gaudi_project_ignore b/Gen/AmpGen/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/BcVegPy/.gaudi_project_ignore b/Gen/BcVegPy/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/GenCuts/CMakeLists.txt b/Gen/GenCuts/CMakeLists.txt
index bae933c349fb1c06c5f981037deebb91dbf4e88e..cc4b49555817cf08c895e0758a33ed5f12a1cbf4 100644
--- a/Gen/GenCuts/CMakeLists.txt
+++ b/Gen/GenCuts/CMakeLists.txt
@@ -1,19 +1,19 @@
 ################################################################################
 # Package: GenCuts
 ################################################################################
-gaudi_subdir(GenCuts v3r13)
+gaudi_subdir(GenCuts v4r0)
 
 gaudi_depends_on_subdirs(GaudiAlg
-                         Kernel/MCInterfaces
-                         Phys/LoKiGen)
+                         Gen/GenInterfaces)
 
 find_package(FastJet)
 find_package(Boost)
 find_package(ROOT)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS})
+AddHepMC3()
 
 gaudi_add_module(GenCuts
-                 src/*.cpp
-                 INCLUDE_DIRS Kernel/MCInterfaces FastJet
-                 LINK_LIBRARIES GaudiAlgLib LoKiGenLib FastJet)
+                 src_future/*.cpp
+                 INCLUDE_DIRS GenInterfaces ${HEPMC3_INCLUDE_DIR}
+                 LINK_LIBRARIES GaudiAlgLib GeneratorsLib ${HEPMC3_LIBRARIES})
 
diff --git a/Gen/GenCuts/src/DaughtersInLHCb.cpp b/Gen/GenCuts/src/DaughtersInLHCb.cpp
deleted file mode 100755
index 801c266e30289f8282c1f8b034105fb35eff8cae..0000000000000000000000000000000000000000
--- a/Gen/GenCuts/src/DaughtersInLHCb.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// $Id: DaughtersInLHCb.cpp,v 1.7 2008-07-09 14:33:47 robbep Exp $
-// Include files 
-
-// local
-#include "DaughtersInLHCb.h"
-
-// from Gaudi
-#include "GaudiKernel/SystemOfUnits.h"
-
-// from Kernel
-#include "Kernel/ParticleID.h"
-#include "GaudiKernel/Vector4DTypes.h"
-
-// from HepMC
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenVertex.h"
-
-// from Generators
-#include "GenEvent/HepMCUtils.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : DaughtersInLHCb
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( DaughtersInLHCb )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-DaughtersInLHCb::DaughtersInLHCb( const std::string& type,
-                                  const std::string& name,
-                                  const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IGenCutTool >( this ) ;
-    declareProperty( "ChargedThetaMin" , m_chargedThetaMin = 10 * Gaudi::Units::mrad ) ;
-    declareProperty( "ChargedThetaMax" , m_chargedThetaMax = 400 * Gaudi::Units::mrad ) ;
-    declareProperty( "NeutralThetaMin" , m_neutralThetaMin = 5 * Gaudi::Units::mrad ) ;
-    declareProperty( "NeutralThetaMax" , m_neutralThetaMax = 400 * Gaudi::Units::mrad ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-DaughtersInLHCb::~DaughtersInLHCb( ) { ; }
-
-//=============================================================================
-// Acceptance function
-//=============================================================================
-bool DaughtersInLHCb::applyCut( ParticleVector & theParticleVector ,
-                                const HepMC::GenEvent * /* theEvent */ ,
-                                const LHCb::GenCollision * /* theHardInfo */ )
-  const {
-  ParticleVector::iterator it ;
-  
-  for ( it = theParticleVector.begin() ; it != theParticleVector.end() ; ) {    
-    if ( ! passCuts( *it ) ) {
-      it = theParticleVector.erase( it ) ;
-    } else ++it ;
-  }
-
-  
-  return ( ! theParticleVector.empty() ) ;
-}
-
-//=============================================================================
-// Functions to test if all daughters are in acceptance
-//=============================================================================
-bool DaughtersInLHCb::passCuts( const HepMC::GenParticle * theSignal ) const {
-  HepMC::GenVertex * EV = theSignal -> end_vertex() ;
-  if ( 0 == EV ) return true ;
-
-  typedef std::vector< HepMC::GenParticle * > Particles ;
-  Particles stables ;
-  HepMC::GenVertex::particle_iterator iter ;
-
-  for ( iter = EV -> particles_begin( HepMC::descendants ) ; 
-        iter != EV -> particles_end( HepMC::descendants ) ; ++iter ) {
-    if ( 0 == (*iter) -> end_vertex() ) stables.push_back( *iter ) ;
-  }  
-
-  if ( stables.empty() )
-    Exception( "Signal has no stable daughters !" ) ;
-
-  double angle( 0. ) ;
-  double firstpz = stables.front() -> momentum().pz() ;
-
-  debug() << "New event" << endmsg ;
-
-  for ( Particles::const_iterator it = stables.begin() ; it != stables.end() ;
-        ++it ) {
-
-    debug() << "Check particle " << (*it) -> pdg_id() << " with angle " 
-            << (*it) -> momentum().theta() / Gaudi::Units::mrad 
-            << " mrad." << endmsg ;
-   
-    // Remove neutrinos
-    if ( ( 12 == abs( (*it) -> pdg_id() ) ) || 
-         ( 14 == abs( (*it) -> pdg_id() ) ) || 
-         ( 16 == abs( (*it) -> pdg_id() ) ) ) continue ;
- 
-    // Don't use daughters of Lambda and KS:
-    HepMC::GenParticle * theParent ;
-    theParent = 
-      *( (*it) -> production_vertex() -> particles_in_const_begin() ) ;
-    if ( 3122 == abs( theParent -> pdg_id() ) ) continue ;
-    if ( 310 == theParent -> pdg_id() ) continue ;
-
-    // Consider only gammas from pi0 and eta
-    if ( 22 == (*it) -> pdg_id() ) {
-      if ( ( 111 != theParent -> pdg_id() ) &&
-           ( 221 != theParent -> pdg_id() ) ) continue ;
-    }
-
-    // All particles in same direction
-    if ( 0 > ( firstpz * ( (*it) -> momentum().pz() ) ) ) return false ;
-      
-    angle = (*it) -> momentum().theta() ;
-    
-    LHCb::ParticleID pid( (*it) -> pdg_id() ) ;
-    if ( 0 == pid.threeCharge() ) {
-      if ( fabs( sin( angle ) ) > fabs( sin( m_neutralThetaMax ) ) ) 
-        return false ;
-      if ( fabs( sin( angle ) ) < fabs( sin( m_neutralThetaMin ) ) ) 
-        return false ;
-    } else {
-      if ( fabs( sin( angle ) ) > fabs( sin( m_chargedThetaMax ) ) ) 
-        return false ;
-      if ( fabs( sin( angle ) ) < fabs( sin( m_chargedThetaMin ) ) ) 
-        return false ;
-    }
-  }
-
-  debug() << "Event passed !" << endmsg ;
-  
-  return true ;
-}
diff --git a/Gen/GenCuts/src_future/DaughtersInLHCb.cpp b/Gen/GenCuts/src_future/DaughtersInLHCb.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..c2c4bd690d2c67ca7c6a535c2b2ad7d1c774c585
--- /dev/null
+++ b/Gen/GenCuts/src_future/DaughtersInLHCb.cpp
@@ -0,0 +1,107 @@
+// $Id: DaughtersInLHCb.cpp,v 1.7 2008-07-09 14:33:47 robbep Exp $
+// Include files
+
+// local
+#include "DaughtersInLHCb.h"
+
+// from Gaudi
+#include "GaudiKernel/SystemOfUnits.h"
+
+// from Kernel
+#include "GaudiKernel/Vector4DTypes.h"
+#include "HepMC3/Relatives.h"
+#include "Kernel/ParticleID.h"
+
+//-----------------------------------------------------------------------------
+// Implementation file for class : DaughtersInLHCb
+//
+// 2005-08-17 : Patrick Robbe
+//-----------------------------------------------------------------------------
+
+// Declaration of the Tool Factory
+
+DECLARE_COMPONENT(DaughtersInLHCb)
+
+//=============================================================================
+// Acceptance function
+//=============================================================================
+bool DaughtersInLHCb::applyCut(ParticleVector& theParticleVector,
+                               const HepMC3::GenEvent*,
+                               const LHCb::GenCollision*) const {
+  ParticleVector tmp;
+  for (auto p : theParticleVector) {
+
+    if (passCuts(p)) {
+      tmp.push_back(p);
+    }
+  }
+  theParticleVector = tmp;
+
+  return (!theParticleVector.empty());
+}
+
+//=============================================================================
+// Functions to test if all daughters are in acceptance
+//=============================================================================
+bool DaughtersInLHCb::passCuts(const HepMC3::GenParticlePtr theSignal) const {
+  auto EV = theSignal->end_vertex();
+  if (0 == EV) return true;
+
+  typedef std::vector<HepMC3::GenParticlePtr> Particles;
+  Particles stables;
+
+  for (auto desc : HepMC3::Relatives::DESCENDANTS(theSignal)) {
+    if (!desc->end_vertex()) {
+      stables.push_back(desc);
+    }
+  }
+
+  if (stables.empty()) Exception("Signal has no stable daughters !");
+
+  double angle(0.);
+  double firstpz = stables.front()->momentum().pz();
+
+  for (auto stable : stables) {
+    if (msgLevel(MSG::DEBUG)) {
+      debug() << "Check particle " << stable->pdg_id() << " with angle "
+              << stable->momentum().theta() / Gaudi::Units::mrad << " mrad."
+              << endmsg;
+    }
+
+    // Remove neutrinos
+    if ((12 == abs(stable->pdg_id())) || (14 == abs(stable->pdg_id())) ||
+        (16 == abs(stable->pdg_id())))
+      continue;
+
+    // Don't use daughters of Lambda and KS:
+    auto theParent = *std::begin(stable->parents());
+    if (3122 == abs(theParent->pdg_id())) continue;
+    if (310 == theParent->pdg_id()) continue;
+
+    // Consider only gammas from pi0 and eta
+    if (22 == stable->pdg_id()) {
+      if ((111 != theParent->pdg_id()) && (221 != theParent->pdg_id()))
+        continue;
+    }
+
+    // All particles in same direction
+    if (0 > (firstpz * (stable->momentum().pz()))) return false;
+
+    angle = stable->momentum().theta();
+
+    LHCb::ParticleID pid(stable->pdg_id());
+    if (0 == pid.threeCharge()) {
+      if (fabs(sin(angle)) > fabs(sin(m_neutralThetaMax))) return false;
+      if (fabs(sin(angle)) < fabs(sin(m_neutralThetaMin))) return false;
+    } else {
+      if (fabs(sin(angle)) > fabs(sin(m_chargedThetaMax))) return false;
+      if (fabs(sin(angle)) < fabs(sin(m_chargedThetaMin))) return false;
+    }
+  }
+
+  if (msgLevel(MSG::DEBUG)) {
+    debug() << "Event passed !" << endmsg;
+  }
+
+  return true;
+}
diff --git a/Gen/GenCuts/src/DaughtersInLHCb.h b/Gen/GenCuts/src_future/DaughtersInLHCb.h
similarity index 59%
rename from Gen/GenCuts/src/DaughtersInLHCb.h
rename to Gen/GenCuts/src_future/DaughtersInLHCb.h
index 249540f9660027d5c9a82aa585f4b2be81c9efa5..a7da36cb5e95c8e58d2a177d2895632dc1ea5591 100755
--- a/Gen/GenCuts/src/DaughtersInLHCb.h
+++ b/Gen/GenCuts/src_future/DaughtersInLHCb.h
@@ -1,13 +1,15 @@
-// $Id: DaughtersInLHCb.h,v 1.4 2008-05-29 14:21:59 gcorti Exp $
-#ifndef GENCUTS_DAUGHTERSINLHCB_H
-#define GENCUTS_DAUGHTERSINLHCB_H 1
+#pragma once
 
 // Include files
 // from Gaudi
 #include "GaudiAlg/GaudiTool.h"
 
-#include "MCInterfaces/IGenCutTool.h"
+#include "GenInterfaces/IGenCutTool.h"
 #include "GaudiKernel/Transform4DTypes.h"
+#include "HepMC3/GenParticle.h"
+
+// from Gaudi
+#include "GaudiKernel/SystemOfUnits.h"
 
 /** @class DaughtersInLHCb DaughtersInLHCb.h
  *
@@ -18,47 +20,43 @@
  *  @author Patrick Robbe
  *  @date   2005-08-24
  */
-class DaughtersInLHCb : public GaudiTool, virtual public IGenCutTool {
+class DaughtersInLHCb : public extends<GaudiTool, IGenCutTool> {
  public:
   /// Standard constructor
-  DaughtersInLHCb( const std::string& type,
-                  const std::string& name,
-                  const IInterface* parent);
-
-  virtual ~DaughtersInLHCb( ); ///< Destructor
+  using extends::extends;
+  typedef std::vector< HepMC3::GenParticlePtr > ParticleVector ;
 
   /** Accept events with daughters in LHCb acceptance (defined by min and
    *  max angles, different values for charged and neutrals)
    *  Implements IGenCutTool::applyCut.
    */
   bool applyCut( ParticleVector & theParticleVector ,
-                 const HepMC::GenEvent * theEvent ,
+                 const HepMC3::GenEvent * theEvent ,
                  const LHCb::GenCollision * theCollision ) const override;
 
  private:
   /** Study a particle a returns true when all stable daughters
    *  are in LHCb acceptance
    */
-  bool passCuts( const HepMC::GenParticle * theSignal ) const ;
+  bool passCuts( const HepMC3::GenParticlePtr theSignal ) const ;
 
   /** Minimum value of angle around z-axis for charged daughters
    * (set by options)
    */
-  double m_chargedThetaMin ;
+  Gaudi::Property<double> m_chargedThetaMin{this, "ChargedThetaMin" , 10 * Gaudi::Units::mrad};
 
   /** Maximum value of angle around z-axis for charged daughters
    * (set by options)
    */
-  double m_chargedThetaMax ;
+  Gaudi::Property<double> m_chargedThetaMax{this, "ChargedThetaMax" , 400 * Gaudi::Units::mrad};
 
   /** Minimum value of angle around z-axis for neutral daughters
    * (set by options)
    */
-  double m_neutralThetaMin ;
+  Gaudi::Property<double> m_neutralThetaMin{this,"NeutralThetaMin" , 5 * Gaudi::Units::mrad};
 
   /** Maximum value of angle around z-axis for neutral daughters
    * (set by options)
    */
-  double m_neutralThetaMax ;
+  Gaudi::Property<double> m_neutralThetaMax{this,"NeutralThetaMax" , 400 * Gaudi::Units::mrad};
 };
-#endif // GENCUTS_DAUGHTERSINLHCB_H
diff --git a/Gen/GenTests/.gaudi_project_ignore b/Gen/GenTests/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/GenTune/.gaudi_project_ignore b/Gen/GenTune/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/GenXicc/.gaudi_project_ignore b/Gen/GenXicc/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/Generators/CMakeLists.txt b/Gen/Generators/CMakeLists.txt
deleted file mode 100644
index 6d8f44f10d6f822bbdfa913c7d76669866fdf5e5..0000000000000000000000000000000000000000
--- a/Gen/Generators/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-################################################################################
-# Package: Generators
-################################################################################
-gaudi_subdir(Generators v16r0)
-
-gaudi_depends_on_subdirs(Event/GenEvent
-                         GaudiAlg
-                         Gen/EvtGen
-                         Gen/EvtGenExtras
-                         Kernel/MCInterfaces
-                         Kernel/LHCbKernel
-                         Kernel/PartProp)
-
-find_package(Boost COMPONENTS filesystem system)
-find_package(ROOT)
-find_package(HepMC)
-find_package(Photos++)
-include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${PHOTOS++_INCLUDE_DIRS})
-
-string(REPLACE "-pedantic" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
-string(REPLACE "-Wall" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
-string(REPLACE "-Wextra" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
-string(REPLACE "-Werror=return-type" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
-
-gaudi_add_library(GeneratorsLib
-                  src/Lib/*.cpp src/Lib/*.F
-                  PUBLIC_HEADERS Generators
-                  INCLUDE_DIRS Kernel/MCInterfaces
-                  LINK_LIBRARIES GenEvent GaudiAlgLib EvtGen EvtGenExtras PartPropLib)
-
-gaudi_add_module(Generators
-                 src/component/*.cpp
-                 INCLUDE_DIRS Boost Kernel/MCInterfaces
-                 LINK_LIBRARIES Boost GenEvent GaudiAlgLib LHCbKernel EvtGen EvtGenExtras GeneratorsLib)
-
diff --git a/Gen/Generators/Generators/ExternalGenerator.h b/Gen/Generators/Generators/ExternalGenerator.h
deleted file mode 100755
index bed04fe4d4daa9daf1b49258d1ed86188ec1ea21..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/ExternalGenerator.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// $Id: ExternalGenerator.h,v 1.14 2009-12-03 15:32:49 robbep Exp $
-#ifndef GENERATORS_EXTERNALGENERATOR_H
-#define GENERATORS_EXTERNALGENERATOR_H 1
-
-// Include files
-#include <set>
-
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "Generators/ISampleGenerationTool.h"
-
-// from LHCb
-#include "Kernel/ParticleID.h"
-
-// forward declarations
-class IProductionTool ;
-class IDecayTool ;
-class IGenCutTool ;
-class ICounterLogFile ;
-namespace LHCb { class IParticlePropertySvc ; }
-
-namespace HepMC {
-  class GenEvent ;
-  class GenParticle ;
-}
-
-/** @class ExternalGenerator ExternalGenerator.h "Generators/ExternalGenerator.h"
- *
- *  Base class for sample generation tools which use external generators
- *  (Pythia, Herwig, ...)
- *  This class provides common utility functions which can be used to generate
- *  samples of events of various types.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-
-class ExternalGenerator : public GaudiTool ,
-                          public ISampleGenerationTool {
- public:
-  /// Vector of HepMC particles
-  typedef std::vector< HepMC::GenParticle * > ParticleVector ;
-
-  /// Ordered set of integer to contain PID of particles to generate
-  typedef std::set< int >                     PIDs           ;
-
-  /// Vector of string to pass configuration commands to the external generator
-  typedef std::vector< std::string >          CommandVector  ;
-
-  /// Standard constructor
-  ExternalGenerator( const std::string & type , const std::string & name ,
-                     const IInterface * parent ) ;
-
-  virtual ~ExternalGenerator( ) ; ///< Destructor
-
-  /** Initialization function.
-   *  The function:
-   *  -# configures the LHAPDF library with a default set of commands (enabling
-   *     or disabling LHAPDF output depending on the output level) and with
-   *     optional user commands.
-   *  -# loop over all particles defined in the particle property service
-   *     and declare them stable for the production tool if they are known
-   *     by the decay tool.
-   */
-  StatusCode initialize( ) override;
-
-  /** Finalization funtion.
-   *  This function closes the file used to redirect LHAPDF output messages
-   *  in case the output is disabled.
-   */
-  StatusCode finalize( ) override;
-
- protected:
-  /** Decay heavy excited particles.
-   *  This function decay heavy excited particles with the DecayTool. It
-   *  is necessary to decay excited particles earlier than the other because
-   *  the signal particle can be produced by the decay of an excited particle
-   *  eg. B*0 -> B0 gamma
-   *  @param[in,out] theEvent  HepMC event which contains the particles to
-   *                           decay. The event is updated with the resulting
-   *                           decay trees.
-   *  @param[in]     mass      Mass above which particles are considered "heavy
-   *                           excited particles" and must be decayed with the
-   *                           decay tool.
-   *  @param[in]     pid       PID of the particle which is the ligther to
-   *                           decay, the decay chain is stopped when this
-   *                           particle is found.
-   *  @return     StatusCode::SUCCESS
-   *  @return     StatusCode::ERROR if an unkown excited particle is found (in
-   *                                this case, this particle has to be added to
-   *                                the ParticlePropertySvc or/and the EvtGen
-   *                                decay table).
-   */
-  StatusCode decayHeavyParticles( HepMC::GenEvent * theEvent ,
-                                  const LHCb::ParticleID::Quark theQuark ,
-                                  const int signalPid ) const ;
-
-
-  /** Find particles of given PIDs in an event
-   *  @param[in]  pidList       Ordered (for efficiency) set of PIDs to look
-   *                            for in this event.
-   *  @param[in]  theEvent      Event to study.
-   *  @param[out] particleList  List of particles contained in the event whose
-   *                            PID is in the pidList.
-   *  @return     true if the event contains a particle with correct PID.
-   */
-  bool checkPresence( const PIDs & pidList , const HepMC::GenEvent * theEvent ,
-                      ParticleVector & particleList ) const ;
-
-  /** Parity flip (z -> -z and pz -> -pz) the event
-   *  @param[in,out] theEvent   Event to flip
-   */
-  void revertEvent( HepMC::GenEvent * theEvent ) const ;
-
-  /** Count the number of particle with pz > 0
-   *  @param[in] particleList  List of particles
-   *  @return    Number of particle with pz > 0 in particleList.
-   */
-  unsigned int nPositivePz( const ParticleVector & particleList ) const ;
-
-  /** Prepare interaction before generating it.
-   *  Performs all necessary actions required to prepare LHCb event model
-   *  classes before being able to generate interactions.
-   *  @param[in,out] theEventVector  Vector containing the generated events
-   *  @param[in,out] theHardVector   Vector containing the hard process
-   *                                 informations.
-   *  @param[out]    theGenEvent     Event where to store particles of the
-   *                                 next generated interaction.
-   *  @param[out]    theHardInfo     Object where to store hard process
-   *                                 informations of the next interaction.
-   */
-  void prepareInteraction( LHCb::HepMCEvents * theEvents ,
-                           LHCb::GenCollisions * theCollisions ,
-                           HepMC::GenEvent * & theGenEvent ,
-                           LHCb::GenCollision * & theGenCollision ) const ;
-
-  /** Production tool (interface to external generator) to use to
-   *  generate interactions */
-  IProductionTool * m_productionTool ;
-
-  /// Decay tool to use to decay excited heavy particles (B**)
-  IDecayTool      * m_decayTool      ;
-
-  /// Generator level cut tool to apply to generated interactions
-  IGenCutTool     * m_cutTool        ;
-
-  /// Log file tool
-  ICounterLogFile * m_xmlLogTool ;
-
-  /// Name assigned to the HepMC event and stored with it
-  std::string m_hepMCName ;
-
-  /// Location where to store FSR counters (set by options)
-  /// Not used in this class directly but by almost all 
-  /// derived classes
-  std::string  m_FSRName;
- private:
-  /** Decode commands (given by job options) to configure LHAPDF library.
-   *  @param[in] theCommandVector  Vector of string to configure LHAPDF. The
-   *                               syntax of the command is "lhacontrol block
-   *                               index value" where block is lhaparm (in this
-   *                               the common variable LHAPARM( index ) is set
-   *                               to value) or lhavalue (to set
-   *                               LHAVALUE( index ) to value).
-   */
-  StatusCode parseLhaPdfCommands( const CommandVector & theCommandVector )
-    const ;
-
-  /// Name of the production tool (external generator) to use
-  std::string m_productionToolName ;
-
-  /// Name of the decay tool to use
-  std::string m_decayToolName ;
-
-  /// Name of the generator level cut tool to use
-  std::string m_cutToolName ;
-
-  /// Commands to set the default configuration of LHAPDF (hardcoded)
-  CommandVector m_defaultLhaPdfSettings ;
-
-  /// Optional additional user commands to configure LHAPDF (by job options)
-  CommandVector m_userLhaPdfSettings ;
-
-  /// Keep original particle properties of the production generator
-  bool m_keepOriginalProperties ;
-
-  /// Particle property service
-  LHCb::IParticlePropertySvc * m_ppSvc ;
-};
-#endif // GENERATORS_EXTERNALGENERATOR_H
diff --git a/Gen/Generators/Generators/F77Utils.h b/Gen/Generators/Generators/F77Utils.h
deleted file mode 100755
index b82549e7c87e6c68865bb9d843a304cd363645f6..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/F77Utils.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// $Id: F77Utils.h,v 1.2 2007-06-29 13:21:06 ibelyaev Exp $
-// ============================================================================
-#ifndef GENERATORS_F77UTILS_H 
-#define GENERATORS_F77UTILS_H 1
-// ============================================================================
-// Include files
-// ============================================================================
-// STD & STL 
-// ============================================================================
-#include <string>
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/StatusCode.h"
-// ============================================================================
-/** @namespace  F77Utils F77Utils.h Generators/F77Utils.h
- *  Collection of primitive utilities to open/close FORTRAN units 
- *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
- *  @date   2006-10-03
- */
-namespace F77Utils 
-{
-  // ==========================================================================
-  /** Close the opened F77 file 
-   *  @param lun logical file number 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode close       
-  ( int lun , const bool verbose = false ) ;
-  // ==========================================================================
-  /** Open Fortran file with status="NEW" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openNew    
-  ( int   lun                          , 
-    const std::string& file            , 
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open Fortran file with status="OLD" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openOld     
-  ( int   lun                          , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open Fortran file with status="UNKNOWN" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openUnknown 
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open Fortran file with status="UNKNOWN" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode open 
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** @fn openNewFormatted 
-   *  Open "FORMATTED" Fortran file with status="NEW" 
-   *  @param lun logical file number 
-   *  @param verbose verbosity flag
-   *  @param file file name 
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openNewFormatted
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open "FORMATTED" Fortran file with status="OLD" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openOldFormatted 
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open "FORMATTED" Fortran file with status="UNKNOWN" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openUnknownFormatted 
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** Open "FORMATTED" Fortran file with status="UNKNOWN" 
-   *  @param lun logical file number 
-   *  @param file file name 
-   *  @param verbose verbosity flag
-   *  @return status code 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  StatusCode openFormatted
-  ( int                lun             , 
-    const std::string& file            ,
-    const bool         verbose = false ) ;
-  // ==========================================================================
-  /** find free fortran units
-   *  Program scans fortran units from 99 to 10 to find "free" units, 
-   *  @param verbose verbosity flag
-   *  @return unit 
-   *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
-   *  @date   2006-10-03
-   */
-  int getUnit( const bool verbose = false ) ;
-  // ==========================================================================
-} // end of namespace F77Utils 
-// ============================================================================
-// The END 
-// ============================================================================
-#endif // GENERATORS_F77UTILS_H
-// ============================================================================
diff --git a/Gen/Generators/Generators/GenCounters.h b/Gen/Generators/Generators/GenCounters.h
deleted file mode 100755
index 45c48d890cd163f611f03377ae12b986d022b5f7..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/GenCounters.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// $Id: GenCounters.h,v 1.5 2006-09-19 21:41:43 gcorti Exp $
-#ifndef GENERATORS_GENCOUNTERS_H 
-#define GENERATORS_GENCOUNTERS_H 1
-
-// Include files
-#include "GaudiKernel/MsgStream.h"
-#include "Generators/ICounterLogFile.h"
-
-#include <cmath>
-#include <numeric>
-#include <algorithm>
-
-namespace boost {
-  template< typename T , std::size_t N > class array ;
-}
-
-namespace HepMC {
-  class GenEvent ;
-}
-
-namespace LHCb 
-{
-  class GenFSR ;
-  class GenCountersFSR ;  
-}
-
-
-/** @namespace GenCounters
- *  
- *  Utility functions to print counters and compute efficiencies
- * 
- *  @author Patrick Robbe
- *  @date   2005-11-30
- */
-
-namespace GenCounters {
-  /// Type for hadron counter
-  typedef boost::array< unsigned int , 5 > BHadronCounter ;
-  typedef boost::array< unsigned int , 4 > DHadronCounter ;
-  typedef boost::array< std::string  , 5 > BHadronCNames  ;
-  typedef boost::array< std::string  , 4 > DHadronCNames  ;
-
-  enum bHadronCounterType{ Bd = 0 , ///< counter of B0
-                           Bu , ///< counter of B+
-                           Bs , ///< counter of Bs0
-                           bBaryon , ///< counter of b-baryon
-                           Bc , ///< counter of Bc+
-  } ;
-  
-  enum cHadronCounterType{ D0 , ///< counter of D0
-                           Dch , ///< counter of D+
-                           Ds , ///< counter of Ds
-                           cBaryon , ///< counter of c-baryon
-  } ;
-
-
-  /// Type for excited states counters
-  typedef boost::array< unsigned int , 3 > ExcitedCounter ;
-  typedef boost::array< std::string  , 3 > ExcitedCNames  ;
-
-  enum excitedCounterType { _0star , ///< counter of X (spin 0, ang mom 0)
-                            _1star , ///< counter of X* (spin 1, ang mom 0)
-                            _2star  ///< counter of X** (ang mom 1)
-  } ;
-
-  /** Compute fraction of two numbers A/B
-   *  @param[in] A  Numerator 
-   *  @param[in] B  Denominator
-   *  @return A/B
-   */
-  inline double fraction( const unsigned int A , const unsigned int B ) {
-    return ( (double) A / (double) B ) ;
-  }
-  
-  /** Compute statistical error on fraction
-   *  @param[in] A  Numberator
-   *  @param[in] B  Denominator
-   *  @return Error on A/B
-   */
-  inline double err_fraction( const unsigned int A , const unsigned int B ) {
-    return sqrt( A * ( 1. - ( (double) A / (double) B ) ) ) / ( (double) B ) ;
-  }
-  
-  /** Print efficiency computed with 2 counters.
-   *  @param[in] theStream  Print facility to print the counters and efficiency
-   *                        after/before.
-   *  @param[in] cutName    Description of the cut
-   *  @param[in] after      Number of events after the cut
-   *  @param[in] before     Number of events before the cut
-   */
-  inline void printEfficiency( MsgStream & theStream , 
-                               const std::string & cutName , 
-                               const unsigned int after , 
-                               const unsigned int before ) {
-    if ( 0 == before ) return ;
-    theStream << "Number of events for " << cutName << ", before : " << before
-              << ", after : " << after 
-              << std::endl ;
-    theStream << "Efficiency of the " << cutName << " : " 
-              << format( "%.5g +/- %.5g" , fraction( after , before ) , 
-                         err_fraction( after , before ) ) << std::endl ;
-  }
-
-  /** Print efficiency computed with 2 counters.
-   *  @param[in] theLogFile Log file where to print the counters and efficiency
-   *                        after/before.
-   *  @param[in] cutName    Description of the cut
-   *  @param[in] after      Number of events after the cut
-   *  @param[in] before     Number of events before the cut
-   */
-  inline void printEfficiency( ICounterLogFile * theLogFile , 
-                               const std::string & cutName , 
-                               const unsigned int after , 
-                               const unsigned int before ) {
-    if ( 0 == before ) return ;
-    theLogFile -> addEfficiency( cutName , after , before , 
-                                 fraction( after , before ) , 
-                                 err_fraction( after , before ) ) ;
-  }  
-
-  /** Print a simple counter.
-   *  @param[in] theStream  Print facility to print the counter
-   *  @param[in] name       Description of the counter
-   *  @param[in] value      Value of the counter
-   */  
-  inline void printCounter( MsgStream & theStream , const std::string & name , 
-                            const unsigned int value ) {
-    theStream << "Number of " << name << " : " << value << std::endl ; 
-  }
-
-  /** Print a simple counter.
-   *  @param[in] theLogFile Log file to print the counter
-   *  @param[in] name       Description of the cut
-   *  @param[in] after      Number of events after the cut
-   *  @param[in] before     Number of events before the cut
-   */  
-  inline void printCounter( ICounterLogFile * theLogFile , const std::string & name , 
-                            const unsigned int value ) {
-    theLogFile -> addCounter( name , value ) ;
-  }
-  
-  /** Print fraction computed from two counters.
-   *  @param[in] theStream  Print facility to print the counters and fraction
-   *                        number/total.
-   *  @param[in] name       Description of the fraction
-   *  @param[in] number     Number of particles contained in the fraction
-   *  @param[in] total      Total number of particles.
-   */
-  inline void printFraction( MsgStream & theStream , 
-                             const std::string & name , 
-                             const unsigned int number , 
-                             const unsigned int total ) {
-    theStream << "Number of " << name << " : " << number ;
-    theStream << " [fraction : " 
-              << format( "%.5g +/- %.5g]" , fraction( number , total ) ,
-                         err_fraction( number , total ) ) << std::endl ;  
-  }
-
-  /** Print fraction computed from two counters.
-   *  @param[in] theLogFile Log file where to print the counters and fraction
-   *                        number/total.
-   *  @param[in] name       Description of the fraction
-   *  @param[in] number     Number of particles contained in the fraction
-   *  @param[in] total      Total number of particles.
-   */
-  inline void printFraction( ICounterLogFile * theLogFile , 
-                             const std::string & name , 
-                             const unsigned int number , 
-                             const unsigned int total ) {
-    theLogFile -> addFraction( name , number , fraction( number , total ) , 
-                               err_fraction( number , total ) ) ; 
-  }
-
-  /** Utility function to add an array to another one
-   *  @param[in,out] A   Adds content of B to A
-   *  @param[in]     B   Array to add to content of A 
-   */
-  template< typename T , std::size_t N > 
-  inline void AddTo( boost::array< T , N > & A ,
-                     const boost::array< T , N > & B ) {
-    std::transform( A.begin() , A.end() , B.begin() , A.begin() , 
-                    std::plus< unsigned int >( ) ) ;
-  }
-
-  /** Utility function to print Fractions from a array of counters
-   *  @param[in] 
-   */
-  template< typename T , std::size_t N >
-  inline void printArray( MsgStream & theStream ,
-                          boost::array< T , N > A ,
-                          boost::array< std::string , N > AName ,
-                          const std::string & root ) {
-    unsigned int total = std::accumulate( A.begin() , A.end() , 0 ) ;
-    for ( unsigned int i = 0 ; i < A.size() ; ++i ) 
-      printFraction( theStream , root + " " + AName[ i ] , A[ i ] , total ) ;
-  }
-
-  /** Utility function to print Fractions from a array of counters
-   *  @param[in] 
-   */
-  template< typename T , std::size_t N >
-  inline void printArray( ICounterLogFile * theLogFile ,
-                          boost::array< T , N > A ,
-                          boost::array< std::string , N > AName ,
-                          const std::string & root ) {
-    unsigned int total = std::accumulate( A.begin() , A.end() , 0 ) ;
-    for ( unsigned int i = 0 ; i < A.size() ; ++i ) 
-      printFraction( theLogFile , root + " " + AName[ i ] , A[ i ] , total ) ;
-  }
-
-  /** Utility function to setup names of B hadron counters 
-   *  @param[in] BC      Names of B hadron counters
-   *  @param[in] antiBC  Names of anti-B hadron counters
-   */
-  void setupBHadronCountersNames( BHadronCNames & BC , 
-                                  BHadronCNames & antiBC ) ;
-
-  /** Utility function to setup names of D hadron counters 
-   *  @param[in] DC      Names of D hadron counters
-   *  @param[in] antiDC  Names of anti-D hadron counters
-   */
-  void setupDHadronCountersNames( DHadronCNames & DC , 
-                                  DHadronCNames & antiDC ) ;
-
-  /** Utility function to setup names of excited states counters 
-   *  @param[in] DC      Names of excited states counters
-   *  @param[in] root    Basename 
-   */
-  void setupExcitedCountersNames( ExcitedCNames & B , 
-                                  const std::string & root ) ;
-
-  /** Update counters for excited states.
-   *  @param[in]  theEvent     The event where to count.
-   *  @param[out] thebExcitedC Counters for B(**) 
-   *  @param[out] thecExcitedC Counters for D(**)
-   */
-  void updateExcitedStatesCounters( const HepMC::GenEvent * theEvent ,
-                                    ExcitedCounter & thebExcitedC ,
-                                    ExcitedCounter & thecExcitedC ) ;
-
-  /** Update counters for flavour fractions.
-   *  @param[in]  theEvent     The event where to count.
-   *  @param[out] thebHadC     Counters for b-hadrons
-   *  @param[out] theantibHadC Counters for anti-b-hadrons
-   *  @param[out] thecHadC     Counters for c-hadrons
-   *  @param[out] theanticHadC Counters for anti-c-hadrons
-   *  @param[out] thebbCounter Counters for (bb) states
-   *  @param[out] theccCounter Counters for (cc) states
-   */
-  void updateHadronCounters( const HepMC::GenEvent * theEvent , 
-                             BHadronCounter & thebHadC , 
-                             BHadronCounter & theantibHadC ,
-                             DHadronCounter & thecHadC ,
-                             DHadronCounter & theanticHadC , 
-                             unsigned int & thebbCounter , 
-                             unsigned int & theccCounter ) ;
-  
-  void updateHadronFSR( const HepMC::GenEvent* theEvent,
-                        LHCb::GenFSR * genFSR,
-                        const std::string option);
-  
-
-
-}
-
-#endif // GENERATORS_GENCOUNTERS_H
diff --git a/Gen/Generators/Generators/HepMCUtils.h b/Gen/Generators/Generators/HepMCUtils.h
deleted file mode 100755
index 4f655686001ce22f197c850d6e58daf2ed6e652e..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/HepMCUtils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id: HepMCUtils.h,v 1.8 2008-07-23 17:21:55 cattanem Exp $
-#ifndef GENERATORS_HEPMCUTILS_H 
-#define GENERATORS_HEPMCUTILS_H 1
-
-// This include has been moved to Event/GenEvent package.
-// This file is provided for backward compatibility.
-#warning "You should now include GenEvent/HepMCUtils.h instead"
-#include "GenEvent/HepMCUtils.h"
-
-#endif // GENERATORS_HEPMCUTILS_H
diff --git a/Gen/Generators/Generators/IBeamTool.h b/Gen/Generators/Generators/IBeamTool.h
deleted file mode 100755
index 57c8b195ac69639c6e9522045102e8ec4a395161..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IBeamTool.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// $Id: IBeamTool.h,v 1.4 2008-05-29 14:21:46 gcorti Exp $
-#ifndef GENERATORS_IBEAMTOOL_H 
-#define GENERATORS_IBEAMTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-#include "GaudiKernel/Vector3DTypes.h"
-
-/** @class IBeamTool IBeamTool.h "Generators/IBeamTool.h"
- *  
- *  Abstract interface to beam tool providing beam parameters 
- *  for each generated event.
- * 
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-
-static const InterfaceID IID_IBeamTool( "IBeamTool" , 2 , 0 ) ;
-
-class IBeamTool : virtual public IAlgTool {
- public:
-  static const InterfaceID& interfaceID() { return IID_IBeamTool ; }
-  
-  /** Mean beam parameters.
-   *  Provides mean beam parameters (useful to initialize generators).
-   *  @param[out] pBeam1  Mean 3-momentum of beam 1 (pz > 0)
-   *  @param[out] pBeam2  Mean 3-momentum of beam 2 (pz < 0)
-   */
-  virtual void getMeanBeams( Gaudi::XYZVector & pBeam1, 
-                             Gaudi::XYZVector & pBeam2 ) const = 0 ;
-  
-  /** Generate beam parameters.
-   *  @param[out] pBeam1  3-momentum of beam 1 (pz > 0)
-   *  @param[out] pBeam2  3-momentum of beam 2 (pz > 0)
-   */
-  virtual void getBeams( Gaudi::XYZVector & pBeam1, 
-                         Gaudi::XYZVector & pBeam2 ) = 0 ;
-};
-#endif // GENERATORS_IBEAMTOOL_H
diff --git a/Gen/Generators/Generators/ICounterLogFile.h b/Gen/Generators/Generators/ICounterLogFile.h
deleted file mode 100644
index 410d6171778fb76814096ec6f3d1f313603c30a7..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/ICounterLogFile.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef GENERATORS_ICOUNTERLOGFILE_H 
-#define GENERATORS_ICOUNTERLOGFILE_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-
-static const InterfaceID IID_ICounterLogFile ( "ICounterLogFile", 1, 0 );
-
-/** @class ICounterLogFile ICounterLogFile.h Generators/ICounterLogFile.h
- *  
- *
- *  @author Patrick Robbe
- *  @date   2013-01-15
- */
-class ICounterLogFile : virtual public IAlgTool {
-public: 
-
-  // Return the interface ID
-  static const InterfaceID& interfaceID() { return IID_ICounterLogFile; }
-
-  virtual void addEfficiency( const std::string & name , const unsigned int after , 
-                              const unsigned int before , const double fraction , 
-                              const double err_fraction ) = 0 ;
-
-  virtual void addCounter( const std::string & name , const unsigned int value ) = 0 ; 
-
-  virtual void addFraction( const std::string & name , const unsigned int number , 
-                            const double fraction , const double err_fraction ) = 0 ;
-
-  /// Add cross section value, in mb
-  virtual void addCrossSection( const std::string & name , 
-                                const unsigned int processId , 
-                                const unsigned int number , 
-                                const double value ) = 0 ;
-
-  /// Add the event type number
-  virtual void addEventType( const unsigned int evType ) = 0 ;
-
-  /// Add the Gauss version
-  virtual void addGaussVersion( const std::string & version ) = 0 ;
-
-  /// Add the method type
-  virtual void addMethod( const std::string & type ) = 0 ;
-
-  /// Add the generator
-  virtual void addGenerator( const std::string & generator ) = 0 ;
-  
-protected:
-
-private:
-
-};
-#endif // GENERATORS_ICOUNTERLOGFILE_H
diff --git a/Gen/Generators/Generators/IDecayTool.h b/Gen/Generators/Generators/IDecayTool.h
deleted file mode 100755
index 056817fd376abbabd6e0343e10f265eb15e6ff4e..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IDecayTool.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id: HepMCUtils.h,v 1.8 2008-07-23 17:21:55 cattanem Exp $
-#ifndef GENERATORS_IGENCUTTOOL_H 
-#define GENERATORS_IGENCUTTOOL_H 1
-
-// This include has been moved to Event/GenEvent package.
-// This file is provided for backward compatibility.
-#warning "You should now include MCInterfaces/IDecayTool.h instead"
-#include "MCInterfaces/IDecayTool.h"
-
-#endif // GENERATORS_IGENCUTTOOL_H
diff --git a/Gen/Generators/Generators/IFullGenEventCutTool.h b/Gen/Generators/Generators/IFullGenEventCutTool.h
deleted file mode 100755
index cf72f23789f2f656e3f5ad19d5bcf9d2b7be5254..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IFullGenEventCutTool.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id: HepMCUtils.h,v 1.8 2008-07-23 17:21:55 cattanem Exp $
-#ifndef GENERATORS_IFULLGENEVENTCUTTOOL_H 
-#define GENERATORS_IFULLGENEVENTCUTTOOL_H 1
-
-// This include has been moved to Event/GenEvent package.
-// This file is provided for backward compatibility.
-#warning "You should now include MCInterfaces/IFullGenEventCutTool.h instead"
-#include "MCInterfaces/IFullGenEventCutTool.h"
-
-#endif // GENERATORS_IFULLGENEVENTCUTTOOL_H
diff --git a/Gen/Generators/Generators/IGenCutTool.h b/Gen/Generators/Generators/IGenCutTool.h
deleted file mode 100755
index 561365646d54e81242053467729267453e904ef6..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IGenCutTool.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id: HepMCUtils.h,v 1.8 2008-07-23 17:21:55 cattanem Exp $
-#ifndef GENERATORS_IGENCUTTOOL_H 
-#define GENERATORS_IGENCUTTOOL_H 1
-
-// This include has been moved to Event/GenEvent package.
-// This file is provided for backward compatibility.
-#warning "You should now include MCInterfaces/IGenCutTool.h instead"
-#include "MCInterfaces/IGenCutTool.h"
-
-#endif // GENERATORS_IGENCUTTOOL_H
diff --git a/Gen/Generators/Generators/IPileUpTool.h b/Gen/Generators/Generators/IPileUpTool.h
deleted file mode 100755
index a6e11bf3f8d8ec9b66210fac2a8244ca18c09c7b..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IPileUpTool.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// $Id: IPileUpTool.h,v 1.4 2009-04-07 16:18:32 gcorti Exp $
-#ifndef GENERATORS_IPILEUPTOOL_H 
-#define GENERATORS_IPILEUPTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-
-/** @class IPileUpTool IPileUpTool.h "Generators/IPileUpTool.h"
- *  
- *  Abstract interface to pile up tools. Generates the number of pile-up
- *  interactions to generate for each event.
- * 
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-
-static const InterfaceID IID_IPileUpTool( "IPileUpTool" , 3 , 0 ) ;
-
-class IPileUpTool : virtual public IAlgTool {
-public:
-  static const InterfaceID& interfaceID() { return IID_IPileUpTool ; }
-
-  /** Computes the number of pile-up interactions in the event.
-   *  @param[out] currentLuminosity  Luminosity of the current event.
-   *  @return Number of pile-up interactions to generate.
-   */
-  virtual unsigned int numberOfPileUp( ) = 0 ;
-
-  /// Print various counters at the end of the job
-  virtual void printPileUpCounters( ) = 0 ;
-};
-#endif // GENERATORS_IPILEUPTOOL_H
diff --git a/Gen/Generators/Generators/IProductionTool.h b/Gen/Generators/Generators/IProductionTool.h
deleted file mode 100755
index 6fdd8a3d8dcb3d9dafdb9a00de5c1a94bfe76c44..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IProductionTool.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// $Id: IProductionTool.h,v 1.7 2007-03-08 13:40:09 robbep Exp $
-#ifndef GENERATORS_IPRODUCTIONTOOL_H 
-#define GENERATORS_IPRODUCTIONTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-
-// Forward declarations
-namespace HepMC { class GenEvent ; }
-namespace LHCb { class GenCollision ; 
-  class ParticleProperty ;
-}
-
-
-
-/** @class IProductionTool IProductionTool.h "Generators/IProductionTool.h"
- *  
- *  Abstract interface to production generators. Concrete tools are 
- *  interface to production generators (Pythia, HERWIG, ...) 
- * 
- *  @author Patrick Robbe
- *  @date   2005-08-16
- */
-
-static const InterfaceID IID_IProductionTool( "IProductionTool" , 4 , 0 ) ;
-
-class IProductionTool : virtual public IAlgTool {
-public:
-  static const InterfaceID& interfaceID() { return IID_IProductionTool ; }
-  
-  /** Generate a primary interaction. 
-   *  The generated event contains all what happens up to the decay of
-   *  hadrons. Decay of hadrons will be performed in general by the decay
-   *  tool. Then all hadrons must be declared stable in the production
-   *  generator. This is done thanks to IProductionTool::setStable.
-   *  @param[out] theEvent  Event generated by the production generator.
-   *  @param[out] theInfo   Informations about the hard process of the
-   *                        generated interaction.
-   */
-  virtual StatusCode generateEvent( HepMC::GenEvent * theEvent , 
-                                    LHCb::GenCollision * theInfo ) = 0 ;
-
-  /// Declare a particle stable to the production generator.
-  virtual void setStable( const LHCb::ParticleProperty * thePP ) = 0 ;
-
-  /** Update the properties of the particle in the production generator
-   *  with values from the particle property service.
-   */
-  virtual void updateParticleProperties( const LHCb::ParticleProperty * thePP ) = 0 ;
-
-  /// Turn off the fragmentation step in the generation.
-  virtual void turnOffFragmentation( ) = 0 ;
-
-  /// Turn on the fragmentation step in the generation.
-  virtual void turnOnFragmentation( )  = 0 ;
-
-  /** Hadronize the event.
-   *  @param[in,out] theEvent  Unfragmented event to hadronize.
-   *  @param[out]    theInfo   Informations about the hard process of the 
-   *                           generated interaction.
-   */
-  virtual StatusCode hadronize( HepMC::GenEvent * theEvent , 
-                                LHCb::GenCollision * theInfo ) = 0 ;
-
-  /// Save the parton level event (when the fragmentation is turned off)
-  virtual void savePartonEvent( HepMC::GenEvent * theEvent ) = 0 ;
-
-  /// Retrieve the previously saved parton event to re-hadronize it.
-  virtual void retrievePartonEvent( HepMC::GenEvent * theEvent ) = 0 ;
-
-  /// Print configuration of production generator 
-  virtual void printRunningConditions( ) = 0 ;
-
-  /** Define special particles whose properties must not be updated from 
-   *  the particle property service (like mass of top quark, ...)
-   */
-  virtual bool isSpecialParticle( const LHCb::ParticleProperty * thePP ) const = 0 ;
-
-  /// Prepare the generator to force fragmentationto in the thePdgId flavour.
-  virtual StatusCode setupForcedFragmentation( const int thePdgId ) = 0 ;
-
-  /// Specific initialization of the Generator
-  virtual StatusCode initializeGenerator( ) = 0 ;
-};
-#endif // GENERATORS_IPRODUCTIONTOOL_H
diff --git a/Gen/Generators/Generators/ISampleGenerationTool.h b/Gen/Generators/Generators/ISampleGenerationTool.h
deleted file mode 100755
index c2197a43278f5f1179318b975703b0623b2c6913..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/ISampleGenerationTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id: ISampleGenerationTool.h,v 1.4 2005-12-31 17:30:37 robbep Exp $
-#ifndef GENERATORS_ISAMPLEGENERATIONTOOL_H 
-#define GENERATORS_ISAMPLEGENERATIONTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-
-// From Event
-#include "Event/HepMCEvent.h"
-#include "Event/GenCollision.h"
-
-/** @class ISampleGenerationTool ISampleGenerationTool.h "Generators/ISampleGenerationTool.h"
- *  
- *  Abstract interface to generation of event samples. Concrete tools implement
- *  the algorithms used to generate the various event types generated in LHCb
- *  (Minimum bias, inclusive, signal with repeated hadronization, ...)
- * 
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-
-static const InterfaceID IID_ISampleGenerationTool( "ISampleGenerationTool" , 
-                                                    2 , 0 ) ;
-
-class ISampleGenerationTool : virtual public IAlgTool {
- public:
-  static const InterfaceID& interfaceID() { return IID_ISampleGenerationTool; }
-
-  /** Generate a set of pile-up interactions to form an event
-   *  @param[in]  nPileUp        Number of pile-up event to generate for 
-   *                             this event.
-   *  @param[out] theEvents      Container of the generated pile-up 
-   *                             interactions.
-   *  @param[out] theCollisions  Container of the hard process information
-   *                             for each pile-up interaction.
-   */
-  virtual bool generate( const unsigned int nPileUp ,
-                         LHCb::HepMCEvents * theEvents ,
-                         LHCb::GenCollisions * theCollisions ) = 0 ;
-
-  /// Print counters and efficiencies at the end of the job.
-  virtual void printCounters( ) const = 0 ;
-};
-#endif // GENERATORS_ISAMPLEGENERATIONTOOL_H
diff --git a/Gen/Generators/Generators/IVertexSmearingTool.h b/Gen/Generators/Generators/IVertexSmearingTool.h
deleted file mode 100755
index 173e013cd1a7aa72942f3d986dbee50ed06f295b..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/IVertexSmearingTool.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// $Id: IVertexSmearingTool.h,v 1.3 2005-12-31 17:30:37 robbep Exp $
-#ifndef GENERATORS_IVERTEXSMEARINGTOOL_H 
-#define GENERATORS_IVERTEXSMEARINGTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-
-// Forward declaration
-namespace LHCb {
-  class HepMCEvent ;
-}
-
-/** @class IVertexSmearingTool IVertexSmearingTool.h "Generators/IVertexSmearingTool.h"
- *  
- *  Abstract interface to vertex smearing tools. Concrete implementations 
- *  apply vertex smearing algorithms to each generated pile-up interactions.
- * 
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-
-static const InterfaceID IID_IVertexSmearingTool( "IVertexSmearingTool" , 2 , 
-                                                  0 ) ;
-
-class IVertexSmearingTool : virtual public IAlgTool {
-public:
-  static const InterfaceID& interfaceID() { return IID_IVertexSmearingTool ; }
-  
-  /// Smear the vertex of the interaction (independantly of the others)
-  virtual StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) = 0 ;
-};
-#endif // GENERATORS_ISMEARINGTOOL_H
diff --git a/Gen/Generators/Generators/LHAPDFCommonBlocks.h b/Gen/Generators/Generators/LHAPDFCommonBlocks.h
deleted file mode 100755
index 01826165741fd88e6541760460c8fb2f0ebb1e94..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/LHAPDFCommonBlocks.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// $Id: LHAPDFCommonBlocks.h,v 1.3 2009-10-22 16:43:05 robbep Exp $
-
-#ifndef GENERATORS_LHAPDFCOMMONBLOCKS_H
-#define GENERATORS_LHAPDFCOMMONBLOCKS_H 1
-
-#include <string>
-
-/** @class Lhacontrol LHAPDFCommonBlocks.h "Generators/LHAPDFCommonBlocks.h"
- *
- *  Class to access LHACONTROL LhaPdf Common block from C++ code.
- * 
- *  @author Patrick Robbe
- *  @date   2005-12-06
- */
-
-class Lhacontrol {
- public:
-  Lhacontrol(); ///< Constructor 
-
-  ~Lhacontrol(); ///< Destructor
-
-  /** Set value of LHAVALUE array in common LHACONTROL.
-   *  @param[in] n     Index of the array to modify.
-   *  @param[in] value Value to set to LHAVALUE(n).
-   */
-  void setlhavalue( const int n , const double value) ;
-
-  /** Set value of LHAPARM array in common LHACONTROL.
-   *  @param[in] n     Index of the array to modify.
-   *  @param[in] value Value to set to LHAPARM(n).
-   */
-  void setlhaparm( const int n , const std::string & value ) ;
-
-  /** Set value of LHAVALUE array in common LHACONTROL.
-   *  @param[in]  n     Index of the array to modify.
-   *  @param[out] value Value of LHAVALUE(n).
-   */  
-  void getlhavalue( int n , double & value) ;
-
-  /** Set value of LHAPARM array in common LHACONTROL.
-   *  @param[in]  n     Index of the array to modify.
-   *  @param[out] value Value of LHAPARM(n).
-   */  
-  void getlhaparm( int n , std::string & value ) ;  
-  
- private:
-  /// Length of the LHAPARM and LHAVALUE arrays
-  int lenlhaparm() const { return s_lenlhaparm ; }
-
-  /// Size of the LHAPARM and LHAVALUE arrays
-  static const int s_lenlhaparm = 20 ;
-
-  /// Dummy string value to return in case of error.
-  const char * m_dummystr ;
-
-  /// Dummy value double value to return in case of error.
-  double m_dummy;
-};
-#endif // GENERATORS_LHAPDFCOMMONBLOCKS_H
- 
diff --git a/Gen/Generators/Generators/LbPhotos.h b/Gen/Generators/Generators/LbPhotos.h
deleted file mode 100644
index c5207153c371e45a88ed49c2831a1e177eb2b82e..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/LbPhotos.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef GENERATORS_LBPHOTOS_H 
-#define GENERATORS_LBPHOTOS_H 1
-
-// Include files
-
-/** @class LbPhotos LbPhotos.h Generators/LbPhotos.h
- *  
- *
- *  @author Patrick Robbe
- *  @date   2013-05-31
- */
-class LbPhotos {
-public: 
-  /// Set output unit of Photos
-  static void setOutputUnit( int outputUnit ) ;
-
-};
-#endif // GENERATORS_LBPHOTOS_H
diff --git a/Gen/Generators/Generators/LbTaula.h b/Gen/Generators/Generators/LbTaula.h
deleted file mode 100644
index 85ea175a28554b862c69a2617afba7f934fc2db3..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/LbTaula.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef GENERATORS_LBTAULA_H 
-#define GENERATORS_LBTAULA_H 1
-
-// Include files
-
-/** @class LbTaula LbTaula.h Generators/LbTaula.h
- *  
- *
- *  @author Patrick Robbe
- *  @date   2013-05-31
- */
-class LbTaula {
-public: 
-  /// Set output unit of Taula
-  static void setOutputUnit( int outputUnit ) ;
-
-};
-#endif // GENERATORS_LBTAULA_H
diff --git a/Gen/Generators/Generators/LhaPdf.h b/Gen/Generators/Generators/LhaPdf.h
deleted file mode 100755
index e3029b38abd1ab2b2e4733874e547095847ac7a7..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/LhaPdf.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// $Id: LhaPdf.h,v 1.3 2008-05-23 11:55:05 robbep Exp $
-#ifndef GENERATORS_LHAPDF_H 
-#define GENERATORS_LHAPDF_H 1
-
-// Include files
-#include "Generators/LHAPDFCommonBlocks.h"
-
-/** @class LhaPdf LhaPdf.h "Generators/LhaPdf.h"
- * 
- *  Utility class to access LHAPDF Fortran Functions. 
- *
- *  @author Patrick Robbe
- *  @date   2005-12-06
- */
-class LhaPdf {
- public:
-  /// Access to LHACONTROL common block
-  static Lhacontrol & lhacontrol() { return s_lhacontrol ; }
-  
- private:
-  static Lhacontrol s_lhacontrol ; ///< LHACONTROL Common Block data
-};
-#endif // GENERATORS_LHAPDF_H
diff --git a/Gen/Generators/Generators/RandomForGenerator.h b/Gen/Generators/Generators/RandomForGenerator.h
deleted file mode 100755
index e5b8c304d6b433a6c1600f3dfde694c2f6fce758..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/RandomForGenerator.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// $Id: RandomForGenerator.h,v 1.2 2007-10-11 13:23:26 robbep Exp $
-#ifndef GENERATORS_RANDOMFORGENERATOR_H 
-#define GENERATORS_RANDOMFORGENERATOR_H 1
-
-// Include files
-#include "GaudiKernel/RndmGenerators.h"
-
-/** @class RandomForGenerator RandomForGenerator.h Generators/RandomForGenerator.h
- *  Simple class to interface with Gaudi Random generator
- *
- *  @author Patrick Robbe
- *  @date   2007-10-10
- */
-class RandomForGenerator {
-public:
-  static Rndm::Numbers & getNumbers() ;
-
-  static double flat( ) ;
-
-protected:
-
-private:
-  static Rndm::Numbers s_randgaudi ;
-};
-#endif // GENERATORS_RANDOMFORGENERATOR_H
diff --git a/Gen/Generators/Generators/Signal.h b/Gen/Generators/Generators/Signal.h
deleted file mode 100755
index c7f411f5b8a76d1212fa365722bbfcb066c97952..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/Signal.h
+++ /dev/null
@@ -1,198 +0,0 @@
-// $Id: Signal.h,v 1.8 2007-02-22 13:30:24 robbep Exp $
-#ifndef GENERATORS_SIGNAL_H
-#define GENERATORS_SIGNAL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/ExternalGenerator.h"
-
-#include "Generators/GenCounters.h"
-
-#include <boost/array.hpp>
-
-// Forward declarations
-namespace HepMC {
-  class GenParticle ;
-}
-
-/** @class Signal Signal.h "Generators/Signal.h"
- *
- *  Base class for signal samples generation tools. It contains utility
- *  function that can be used when generating signal samples.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class Signal : public ExternalGenerator {
- public:
-  /// Vector of particles
-  typedef std::vector< HepMC::GenParticle * > GenParticles ;
-
-  /// Standard constructor
-  Signal( const std::string& type, const std::string& name,
-          const IInterface* parent);
-
-  virtual ~Signal( ); ///< Destructor
-
-  /// Initialize
-  StatusCode initialize( ) override;
-
-  /// Print counters and cut efficiencies at the end of the job.
-  void printCounters( ) const override;
-
-protected:
-  /// PID of the signal particle for this job (set by job options)
-  PIDs          m_pids             ;
-
-  /** Flag to indicate if clean events have to be generated (set by job
-   *  options). Clean events are events where only the signal decay tree
-   *  is kept.
-   */
-  bool          m_cleanEvents      ;
-
-  /// Number of events before the generator level cut.
-  unsigned int  m_nEventsBeforeCut ;
-
-  /** Number of events accepted by the generator level cut. This counter is
-   *  used to compute the generator cut efficiency on inclusive events.
-   */
-  unsigned int  m_nEventsAfterCut  ;
-
-  /** Number of signal particles (w/r to anti-particles) before the generator
-   *  level cut.
-   */
-  unsigned int  m_nParticlesBeforeCut ;
-
-  /// Number of signal anti-particles before the generator level cut.
-  unsigned int  m_nAntiParticlesBeforeCut ;
-
-  /** Number of signal particles accepted by the generator level cut. This
-   *  counter is used to compute the generator level cut efficiency to compute
-   *  signal yields.
-   */
-  unsigned int  m_nParticlesAfterCut ;
-
-  /// Number of signal anti-particles accepted by the generator level cut.
-  unsigned int  m_nAntiParticlesAfterCut ;
-
-  /// Number of events parity-flipped. (z -> -z, pz -> -pz)
-  unsigned int  m_nInvertedEvents  ;
-
-  /// Heavier quark of the signal particle
-  LHCb::ParticleID::Quark m_signalQuark ;
-
-  unsigned int  m_signalPID        ; ///< PDG Id of the signal particles
-
-  unsigned int  m_bbCounter        ; ///< Counter of (bb) states in tag side
-
-  unsigned int  m_ccCounter        ; ///< Counter of (cc) states in tag side
-
-  unsigned int  m_nSig             ; ///< Counter of generated signal
-
-  unsigned int  m_nSigBar          ; ///< Counter of generated anti-signal
-
-  std::string   m_sigName          ; ///< Name of signal
-
-  std::string   m_sigBarName       ; ///< Name of anti-signal
-
-  GenCounters::BHadronCounter m_bHadC ; ///< Counter of B hadron (tag side)
-
-  /// Counter of Bbar hadron (tag side)
-  GenCounters::BHadronCounter m_antibHadC ;
-
-  GenCounters::DHadronCounter m_cHadC ; ///< Counter of D hadron (tag side)
-
-  /// Counter of Dbar hadron (tag side)
-  GenCounters::DHadronCounter m_anticHadC ;
-
-  GenCounters::BHadronCNames m_bHadCNames ; ///< Array of B counter names
-
-  /// Array of Bbar hadron names
-  GenCounters::BHadronCNames m_antibHadCNames ;
-
-  GenCounters::DHadronCNames m_cHadCNames ; ///< Array of D counter names
-
-  /// Array of Dbar hadron counter names
-  GenCounters::DHadronCNames m_anticHadCNames ;
-
-  GenCounters::ExcitedCounter m_bExcitedC ; ///< Counter of B(**) (signal side)
-
-  GenCounters::ExcitedCounter m_cExcitedC ; ///< Counter of D(**) (signal side)
-
-  GenCounters::ExcitedCNames m_bExcitedCNames ; ///< Names excited B couters
-
-  GenCounters::ExcitedCNames m_cExcitedCNames ; ///< Names excited D counters
-
-  /// Flag to indicate that a mixture of signal particles and anti-particles.
-  bool          m_cpMixture        ;
-
-  /** Branching fraction of the signal forced decay mode in the main decay
-   *  table.
-   */
-  double        m_signalBr         ;
-
-  Rndm::Numbers m_flatGenerator    ; ///< Flat random nunmber generator
-
-  /** Isolate signal particle decay tree for clean events. The resulting
-   *  event is stored in the container /Event/Gen/SignalDecayTree.
-   */
-  StatusCode isolateSignal( const HepMC::GenParticle * theSignal ) const ;
-
-  /** Choose randomly a particle in a list of particles
-   *  and returns the chosen particle. Invert the event if pz(Signal)<0.
-   *  isInverted is set to true when the chosen particle is inverted.
-   *  The signal particle is forced to decay inside this function.
-   *  hasFlipped is set to true if the particle is flipped by EvtGen
-   *  to generate CP violation.
-   */
-  HepMC::GenParticle * chooseAndRevert( const ParticleVector & particleList ,
-                                        bool & isInverted ,
-                                        bool & hasFlipped ,
-					bool & hasFailed ) ;
-
-  /** Ensures correct multiplicity of signal particles with an accept/reject
-   *  algorithm.
-   *  @param[in] nSignal  Number of particles in the event with flavour
-   *                      corresponding to the flavour of the signal particles.
-   *  @return true if the event has to kept.
-   *  @return false if the event has to be rejected.
-   */
-  bool ensureMultiplicity( const unsigned int nSignal ) ;
-
-  /** Update counters for efficiency calculations.
-   *  @param[in]  particleList         List of particles to count.
-   *  @param[out] particleCounter      Number of particles (w/r to
-   *                                   antiparticles) in particleList.
-   *  @param[out] antiparticleCounter  Number of anti-particles in particleList
-   *  @param[in]  onlyForwardParticles If true, count only particles and
-   *                                   anti-particles with pz>0.
-   *  @param[in]  isInverted           If true, the first particle in the
-   *                                   particleList has been inverted z -> -z
-   */
-  void updateCounters( const ParticleVector & particleList ,
-                       unsigned int & particleCounter ,
-                       unsigned int & antiparticleCounter ,
-                       bool onlyForwardParticles ,
-                       bool isInverted ) const ;
-
- private:
-  /** Add to an existing event a new decay tree.
-   *  @param[out] theNewParticle  Particle to update with the decay tree
-   *                              of theOldParticle.
-   *  @param[in]  theOldParticle  Particle containing the decay tree to add
-   *                              to theNewParticle.
-   */
-  StatusCode fillHepMCEvent( HepMC::GenParticle * theNewParticle ,
-                             const HepMC::GenParticle * theOldParticle )
-    const ;
-
-  /// Temporary ector to obtain PIDs from job options.
-  std::vector< int > m_pidVector   ;
-
-  /// Boolean to control if signal should be reverted if backward
-  bool m_revertWhenBackward = true;
-};
-#endif // GENERATORS_SIGNAL_H
diff --git a/Gen/Generators/Generators/StreamForGenerator.h b/Gen/Generators/Generators/StreamForGenerator.h
deleted file mode 100755
index f1d4adadcda4a35ca45d32c2dc7d1d7594590c29..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/StreamForGenerator.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// $Id: StreamForGenerator.h,v 1.2 2007-10-11 13:23:26 robbep Exp $
-#ifndef GENERATORS_STREAMFORGENERATOR_H 
-#define GENERATORS_STREAMFORGENERATOR_H 1
-
-// Include files
-#include "GaudiKernel/MsgStream.h"
-
-/** @class StreamForGenerator StreamForGenerator.h Generators/StreamForGenerator.h
- *  Simple class to interface with Gaudi Output MsgStream
- *
- *  @author Patrick Robbe
- *  @date   2007-10-10
- */
-class StreamForGenerator {
-public:
-
-  static MsgStream *& getStream() ;
-
-protected:
-
-private:
-  static MsgStream * s_gaudiStream ;
-};
-#endif 
diff --git a/Gen/Generators/Generators/StringParse.h b/Gen/Generators/Generators/StringParse.h
deleted file mode 100755
index 8e8b7d794779c25b77d1af0c908a87534739a423..0000000000000000000000000000000000000000
--- a/Gen/Generators/Generators/StringParse.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// $Id: StringParse.h,v 1.3 2006-04-04 14:58:24 robbep Exp $
-
-#ifndef GENERATORS_STRINGPARSE_H
-#define GENERATORS_STRINGPARSE_H
-
-// Include files
-#include <string>
-#include <vector>
-
-/** @class StringParse StringParse.h "Generators/StringParse.h"
- * 
- *   Utility class to parse a string.
- *   It breaks it into components which are seperated by spaces  
- *   in the original.
- * 
- *  @author Ian Hinchliffe
- *  @date   200-04-01
- */
-
-class StringParse {
- public:
-  StringParse( const std::string & input); ///< Constructor with string
-  
-  StringParse(); ///< Default constructor
-  
-  ~StringParse(); ///< Destructor
-  
-  /// Returns the num-th component of the input string as a string.
-  std::string piece( const int & num ) ;
-  
-  /// Returns the num-th component of the input string as an integer.
-  int intpiece( const int & num ) ; 
-  
-  /// Returns the num-th component of the input string as a double
-  double numpiece(const int & num); 
-
- private:
-  /// Input string
-  std::string m_lstring;
-
-  /// Vector of substrings in input string
-  std::vector<std::string> m_lsubstring;
-
-  /// Number of words in input string.
-  int m_nword;
-
-  /// String to return if past end.
-  std::string m_past_end;
-};
-#endif  //GENERATORS_STRINGPARSE_H
diff --git a/Gen/Generators/doc/BeamSpotMarkovChainSampleVertex-4D-PDF-Mathematica.nb.bz2 b/Gen/Generators/doc/BeamSpotMarkovChainSampleVertex-4D-PDF-Mathematica.nb.bz2
deleted file mode 100644
index d8e1a02692c9dacccaaf1e7a484cf26e334d526d..0000000000000000000000000000000000000000
Binary files a/Gen/Generators/doc/BeamSpotMarkovChainSampleVertex-4D-PDF-Mathematica.nb.bz2 and /dev/null differ
diff --git a/Gen/Generators/doc/release.notes b/Gen/Generators/doc/release.notes
deleted file mode 100755
index 4a3bfd3ad42e07812765d2935b1dd4bede965d13..0000000000000000000000000000000000000000
--- a/Gen/Generators/doc/release.notes
+++ /dev/null
@@ -1,1154 +0,0 @@
-!-----------------------------------------------------------------------------
-! Package     : Gen/Generators
-! Responsible : Patrick ROBBE
-! Purpose     : Common algorithms and tools for all production engines
-!-----------------------------------------------------------------------------
-
-! 2016-07-01 - Davide Fazzini
-	- Added the possibility to store the generator counters in genFSR
-
-!======================= Generators v16r0 2016-03-23 =========================
-! 2016-02-03 - Gloria Corti
- - Changed the default production tool from Pythia6 to Pythia8.
-   . src/Lib/ExternalGenerators.cpp, changed value of property ProductionTool
-   . src/component/Special.cpp, changed value of property PileUpTool
-
-!======================= Generators v15r1 2016-03-02 =========================
-! 2016-02-03 - John Back
- - src/component/EvtGenDecay.cpp: Corrected the name of the m_imHelZero double
-   property from ImHelOne to ImHelZero, which specifies the imaginary part of
-   the helicity 0 spin density matrix element for polarised J/psi and chi_c1.
-   See: https://its.cern.ch/jira/browse/LHCBGAUSS-628.
-
-! 2015-11-18 - Marco Clemencic
- - Disabled warnings for FORTRAN code.
-
-! 2015-11-15 - Marco Clemencic
- - Fixed compilation with CLHEP 2.
-
-! 2015-09-29 - Gerhard Raven
- - add missing #include <algorithm>
-
-!======================= Generators v15r0 2015-08-05 =========================
-! 2015-08-01 - Patrick Robbe
- - Generation.cpp: add the possibility to generate all interactions at the
-   same PV -- used for signal embeding between different generators. The signal
-   is seen as a separate interaction.
-
-!======================= Generators v14r8 2015-05-12 =========================
-! 2015-05-07 - Patrick Robbe
- - Special.cpp: fix to allow not reinitializing the generator, mandatory
-   when reading events from file (in that case the same events would be
-   processed several times)
-
-!======================= Generators v14r7 2014-12-16 =========================
-! 20014-11-28 - Gloria Corti
- - Try to fix warnings when compiling with --pedantic
-
-! 2014-11-19 - Marco Clemencic
- - Updated CMake configuration
-
-! 2014-11-04 - Gloria Corti
- - Move here HistoSmearVertex and FlatSmearVertex tools from LbPGuns
-
-!======================= Generators v14r6 2013-10-10 =========================
-! 2013-09-23 - Marco Clemencic
- - Added CMake configuration file.
-
-! 2013-08-20 - Patrick Robbe
- - Generation.cpp: add extra informations to the xml log file
- - SignalPlain.cpp: fix the generator level cut efficiency counter
-
-!======================= Generators v14r5 2013-07-23 =========================
-! 2013-07-15 - Patrick Robbe
- - src/components/XmlCounterLogFile.cpp: fix cross-section format
-
-! 2013-07-07 - Patrick Robbe
- - src/components/SaveSignalBInformation.h/.cpp : algorithm to save
- in locate "Gen/BInfo" the string from which the B signal comes from
-
-!======================= Generators v14r4 2013-06-27 =========================
-! 2013-06-26 - Patrick Robbe
- - Fix coverity warnings
-
-! 2013-05-31 - Patrick Robbe
- - Add interface code to TAULA and PHOTOS to suppress part of their outputs:
-   . src/Lib/LbTaula.cpp
-   . src/Lib/LBTAULA.F
-   . src/Lib/LbPhotos.cpp
-   . src/Lib/LBPHOTOS.F
-   . Generators/LbPhotos.h
-   . Generators/LbTaula.h
- - EvtGenDecay: suppress PHOTOS and TAULA outputs
-
-! 2013-05-29 - Patrick Robbe
- - Inclusive.cpp: fix problem with release of particle property service
-
-!======================= Generators v14r3 2013-05-16 =========================
-! 2013-05-14 - Aurelien Martens
- - move the call to setIsSignal() in SRH.cpp before the call of generateEvent
-this allows the production tool to know if it is generating a signal of pile up
-at the generatio time to avoid double storing of parton level HepMC
-
-!======================= Generators v14r2 2013-03-27 =========================
-! 2013-03-22 - Stephane Tourneur
- - Minor modification to allow the inclusive production of baryons with
-   no charm nor bottom content
-
-!======================= Generators v14r1 2013-03-13 =========================
-! 2013-02-13 - Patrick Robbe
- - Fix compilation warnings with gcc46
-
-!======================= Generators v14r0 2013-02-04 =========================
-! 2013-02-01 - Aurelien Martens
- - ExternalGenerator.cpp: add call to initializeGenerator, so that
-particle properties are set before initialization of the pythia instance
-
-
-! 2013-01-31 - Patrick Robbe
- - Use Gaudi random number in ApplyPhotos
-
-! 2013-01-27 - Patrick Robbe
- - ApplyPhotos.cpp: adapt to new photos++ interface
-
-! 2013-01-21 - Patrick Robbe
- - EvtGenInPhSpDecay.cpp: remove Photos functions
- - ICounterLogFile, XmlCounterLogFile: add counters for cross-section
-
-! 2013-01-20 - Patrick Robbe
- - Remove Pythia6 from EvtGenDecay tool
-
-! 2013-01-16 - Patrick Robbe
- - Add ICounterLogFile and XmlCounterLogFile classes to store in XML
-   files the counters that allow to compute the generator level cut
-   efficiencies.
-
-! 2012-12-19 - Aurelien Martens
- - Fix SignalRH for pythia8 so that it also hadronize pile-up events.
-
-!======================= Generators v13r0 2012-11-29 =========================
-! 2012-09-27 - Patrick Robbe
- - Added an option to switch off the reinitialization of the pile-up
-   production in the Special method.
- - Fix the bug that events are not smeared (vertex) when there is no
-   decay tool.
-
-! 2012-09-11 - John Back
- - Added the use of the namespace Photospp for src/component/ApplyPhotos.cpp,
-   which is required for Photos++ version 3.5.
-
-! 2012-07-13 - Patrick Robbe
- - Use LHCb::ParticlePropertySvc for the new particle property service
-   name
-
-! 2012-07-22 - Gloria Corti
- - Fix bug in FlatZSmearVertex where the location where to take the beam
-   parameters was empty. (merge from v11r4b)
-
-! 2012-06-11 - Alex Shires
- - update EvtGenInPhSpDecay to allow a configurable input file name
-
-! 2012-05-27 - Patrick Robbe
- - use new ParticlePropertySvc
-
-! 2012-05-08 - Gloria Corti
- - Fix linking problems with boost newer version from building with Gaudi v23r2
-
-! 2012-05-04 - John Back
- - Changed src/component/ApplyPhotos.cpp to use Photos++
- - Removed src/Lib/photos_utils.F
-
-! 2012-04-16 - John Back
- - Some changes in EvtGenDecay.cpp to be compatible with the trunk of EvtGen:
-    a) use updated static instance for EvtGen/EvtDecayTable functions
-    b) added EvtPythia6 include header to still allow Pythia6 initialisation
-      (for some reason, this is still needed here for the initial p-p event)
-    c) commented out photos external fortran function calls.
-   Branch v11r4b is a copy of the trunk prior to the above changes.
-
-!==================== Generators v12 series on a branch ======================
-
-!======================= Generators v11r4 2012-02-12 =========================
-! 2012-02-12 - Gloria Corti
- - Few changes in Generation.cpp and GenCounters for counting in Pythia8 and
-   excited particles in November by Aureliens Martens
-
-! 2012-02-04 - Patrick Robbe
- - Fix decayHeavyParticle function in ExternalGenerator for generation
-   of signal Ks.
-
-!======================= Generators v11r3 2011-11-11 =========================
-! 2011-11-08 - Patrick Robbe
- - cleanup of Generator code
-
-! 2011-10-28 - Alex Shires
- - Added IEvtGenTool to allow sharing of a sibgle EvtGen instance
-   between DecayTools
-   A EvtGenTool.{h,cpp}
-   A IEvtGenTool.h
-   M EvtGenDecay.{h,cpp}
-
-! 2011-10-20 - Patrick Robbe
- - EvtGenDecay.cpp
- - Generation.cpp
- - LHAPDFCommonBlocks.cpp:
-   Fix coverity warnings
-
-!======================= Generators v11r2 2011-10-17 =========================
-! 2011-10-14 - Patrick Robbe
- - EvtGenDecay.cpp
- - SignalPlain.cpp
- - SignalForcedFragmentation.cpp
- - SignalRepeatedHadronization.cpp
- - Generation.cpp
- - Signal.cpp
- - Signal.h
-   Modifications to skip event in case of EvtGen failure
-
-! 2011-09-28 - Alex Shires
- - Added configurable call limit to EvtGenInPhSpDecay
-
-! 2011-09-28 - Patrick Robbe
- - Rename EvtGenDecayInPhSp as EvtGenInPhSpDecay
-
-!======================= Generators v11r1 2011-09-19 =========================
-! 2011-09-14 - Alex Shires
- - Fixes and new parameter file location for EvtGenDecayInPhSp
-
-! 2011-09-13 - Alex Shires
- - Add new DecayTool, EvtGenDecayInPhSp, for reweighting the Kstmumu phase space
-    distribution such that it is flat in q2.
-
-!======================= Generators v11r0 2011-07-15 =========================
-! 2011-07-15 - Gloria Corti
- - Apply pattern not to build on windows, so that conditional use can be
-   removed from GaussSys
-
-! 2011-07-07 - Patrick Robbe
- - Fix coverity warnings
-
-! 2011-06-23 - Patrick Robbe
- - clean header files
- - move IDecayTool.h to MCInterfaces
-
-! 2011-06-22 - Patrick Robbe
- - Move IGenCutTool.h and IFullGenEventCutTool.h to MCInterfaces package
- - Move cut tools to a new Gen/GenCuts package
-
-! 2011-06-20 - Patrick Robbe
- - src/component/ApplyPhotos.cpp: add the possibility to use it for more
-   than one particle type.
-
-! 2011-06-16 - Patrick Robbe
- - src/component/ApplyPhotos.cpp: new algorithm to be able to apply Photos
-   on Z0 decays.
-
-! 2011-06-05 - Vanya Belyaev
-
- - add ``generic'' full-event cut:
-   it analyses the event and accept them according to cuts.
-     e.g. accept ebents with at least two J/psi :
-    xxx.Code = " count( 'J/psi(1S)' == GID ) > 1.5 "
-     in a similar way one can use anyproerteis, including the acceptance
-
-! 2011-05-31 - Victor Coco
- - BiasedBB: add some cuts on number of stable charged daugthers of the B and
-   on minimal R displacement. By default gives the same result than without
-   those cuts
-
-! 2011-05-31 - Patrick Robbe
- - SemilepCutForADS: fix warnings
-
-! 2011-05-29 - Patrick Robbe
- - Generators/IPileUpTool.h: change interface (remove unneeded GenHeader argument,
-   replaced by new beam parameters object)
- - src/component/FixedLuminosity.h
- - src/component/FixedTarget.h
- - src/component/CollidingBeams.h
- - src/component/BeamSpotSmearVertex.cpp
- - src/component/FixedLuminosityForRareProcess.cpp
- - src/component/VariableLuminosity.cpp
- - src/component/Generation.cpp
- - src/component/FixedNInteractions.cpp
- - src/component/BeamSpotSmearVertex.h
- - src/component/FlatZSmearVertex.cpp
- - src/component/FixedLuminosityForSpillOver.h
- - src/component/FixedLuminosityForRareProcess.h
- - src/component/VariableLuminosity.h
- - src/component/FixedLuminosity.cpp
- - src/component/FixedLuminosityForSpillOver.cpp
- - src/component/FixedNInteractions.h
- - src/component/FixedTarget.cpp
- - src/component/FlatZSmearVertex.h
- - src/component/CollidingBeams.cpp
-     Adapt for new BeamParameters event model class
-
-! 2011-05-23 - Alex T. Grecu
- - Replace HepMC::IO_Ascii with HepMC::IO_GenEvent in WriteHepMCAsciiFile
-   algorithm. This way Gauss may be used as MC generator for rivet analyses.
-
-!====================== Generators v10r10 2011-03-17 =========================
-! 2011-03-16 - Alex Shires
- - Rename tool from DaughtersInLHCbAcceptance to DaughtersInLHCbAndWithMinP
-
-! 2011-03-15 - Alex Shires
- - Add in DaughtersInLHCbAcceptance tool to src/components.
-   Allows both DecProdCut and a momentum cut to be made on tracks -
-   default values are 3 GeV for muons and 1 GeV for other charged tracks
-
-! 2011-03-10 - Paolo Gandini
- - Introdude a new cut for applying a cut on minimum value on invariant mass
-   of D0 mu in Bu->D0 mu nu decay. The value can be set via the property
-   "MassMin" with default value at 4600 MeV.
-   Cuts on acceptance of charged and neutral particle are also applied:
-   "ChargedThetaMin" (default = 10mrad), "ChargedThetaMax" (default = 400mrad),
-   "NeutralThetaMin" (defalut = 5mrad), "NeutralThetaMax" (default = 400mrad)
-   . src/component/SemilepCutForADS.{h,cpp}
-
-!====================== Generators v10r9 2010-12-10 ==========================
-! 2010-12-10 - Gloria Corti
- - Allow for a rotation of the beam line with respect to the nominal one.
-   . CollidingBeams.{h,cpp}: the px and py components will be modified
-     accordingly. Angle controllable via properties, by default set to
-     zero.
-   . Not yet implemented in other tools for FixedTarget and Smearing to be
-     used for beam gas simulation.
-
-! 2010-09-19 - Patrick Robbe
- - UpsilonInAcceptance.h/.cpp: add and print counter to be able to
-   determine generator level efficiencies for Upsilon productions.
-
-! 2010-08-01 - Vanya Belyaev
-
- - GenericGenCutTool.cpp
-
-      New generic generator cut tool.
-      It allows fine tuning and configuration of generator
-      level cuts, inclusing 'LHCb-acceptance'-cuts
-
-      One can specify different crietria for different particles,
-      ignore certain particles (e.g. neutrinos) etc...
-
-      The tool also produce the generatorcut efficiencty 2D-histogram.
-      The histogram can be cofigured therough property
-
-!====================== Generators v10r8 2010-05-09 ==========================
-! 2010-05-06 - Gloria CORTI
- - Introduce possibility to have beam spot centered in a given value in the
-   x and y axis. The same for interactions for beam-gas vertex smearing.
-   Values given in options. Default set to zero.
-   . BeamSpotSmearVertex.{h,cpp}
-   . FlatZSmearVertex.{h,cpp}
- - Introduce possibility to have crossing angle included in smearing of
-   interaction, togheter with beam direction, for tools used in beam-gas
-   vertex smearing. The value of the crossing angle can be set by options.
-   Default set to zero.
-   . FlatZSmearVertex.{h,cpp}
-
-! 2010-05-05 - Patrick Robbe
- - EvtGenDecay.cpp: use tmpnam to have unique files when creating the
-   temporary files for photos and EvtGen particle table
-
-!====================== Generators v10r7 2010-03-22 ==========================
-! 2010-03-21 - Patrick Robbe
- - EvtGenDecay.cpp: force Pythia LHCb interface to be initialized to be sure
-   that Pythia is using the correct LHCb settings, even if Pythia is not used
-   as production generator
-
-!====================== Generators v10r6 2009-12-17 ==========================
-! 2009-12-03 - Patrick Robbe
- - src/Lib/ExternalGenerator.h/.cpp: remove the contraint that only
-   B and D excited states can be pre-decayed.
-
-!====================== Generators v10r5 2009-11-04 ==========================
-! 2009-10-22 - Patrick Robbe
- - src/Lib/Signal.cpp: remove the constraint that the signal has a b
-   or a c quark. This will allow Sigma+ signal generation for example.
- - Small fixes for SLC5 compilation
-
-!====================== Generators v10r4 2009-10-05 ==========================
-! 2009-10-02 - Jibo He
- - Correct the Initialize/Finalize (mis)balance for UpsilonDaughtersInLHCb.
-
-! 2009-09-20 - Patrick Robbe
- - Special.cpp: fix initialization sequence for LHAPDF
-
-!====================== Generators v10r3 2009-09-18 ==========================
-! 2009-09-09 - Thomas BLAKE
- - DiLeptonInAcceptance.cpp: Fix bug in mass calculation
-
-! 2009-08-10 - Thomas BLAKE
- - DiLeptonInAcceptance.cpp: Updated code to allow for same sign combinations.
-
-!====================== Generators v10r2 2009-07-15 ==========================
-! 2009-06-19 - Patrick Robbe
- - EvtGenDecay.cpp: reactivates computing of branching fraction in
-    DECAY.DEC
-
-! 2009-06-15 - Gloria CORTI
- - Fix compilation warning of unused variable removing leftover old variable
-   when modified how to store luminosity
-   . Generation.cpp
-
-!====================== Generators v10r1 2009-05-27 ==========================
-! 2009-04-23 - Patrick Robbe
- - Add possibility to obtain Upsilon from higher mass states, in
-   UpsilonDaughtersInLHCb
-
-!====================== Generators v10r0 2009-04-07 ==========================
-! 2009-04-07 - Gloria CORTI
- - Fill new information in GenHeader (frequency and total cross section) in
-   order to be able to reproduce n_mean (collisions/bunch). In order to
-   fill information modify IPileUpTool interface to pass GenHeader rather
-   than "current luminosity". Modify all implemementations of PileUp tools
-   to adopt new interface and fill GenHeader.
-   . IPileUpTool.h
-   . FixedLuminosity.{h,cpp}
-   . FixedLuminosityForRareProcess.{h,cpp}
-   . FixedLuminosityForSpillOver.{h,cpp}
-   . FixedNInteractions.{h,cpp}
-   . VariableLuminosity.{h,cpp}
-   . Generation.cpp
-
-!====================== Generators v9r4 2009-04-06 ===========================
-! 2009-04-06 - Gloria CORTI
- - Tag only, to keep next changes separate
-
-! 2009-04-01 - Patrick Robbe
- - Generation: make it a filter to skip the generation and simulation
-   sequence for 0 interaction
- - Add new pile-up tool: FixedLuminosityForSpillOver which allows 0
-   interaction
-
-! 2009-03-16 - Patrick Robbe
- - EvtGenDecay: fixes for new EvtGen version
-
-! 2009-03-02 - Patrick Robbe
- - ReadHepMCAsciiFile.cpp: move to new method IO_GenEvent instead
-   of deprecated IO_Ascii method for external input files
-
-! 2009-02-26 - Patrick Robbe
- - UpsilonDaughtersInLHCb: add new cut tool specific for Upsilon
-   generation
-
-!====================== Generators v9r3 2009-02-09 ===========================
-! 2009-01-20 - Will REECE
- - EvtGenDecay: Passes the list of models from EvtGenExtras into EvtGen.
-   requirements: Adds dependency on EvtGenExtras.
-
-!====================== Generators v9r2 2009-01-13 ===========================
-! 2008-12-11 - Patrick Robbe
- - Signal.cpp: associate production_vertex to signal_vertex for clean
-   events, to allow correct primary vertex assignment for Geant4.
-
-!====================== Generators v9r1 2008-10-10 ===========================
-! 2008-09-20 - Patrick Robbe
- - ExternalGenerator.cpp: create ParticlePropertySvc if not existing (needed
-   if DecayTool is not used)
- - Signal.cpp: protect in case of empty decay tool
-
-!====================== Generators v9r0 2008-08-25 ===========================
-! 2008-07-24 - Patrick Robbe
- - Move to HEPMC2
-
-! 2008-07-23 - Marco Cattaneo
- - Removed DumpHepMCTree, DumpMC, DumpMCDecay algorithms, moved to
-   Sim/SimComponents, last two renamed DumpHepMC and DumpHepMCDecay
- - Generator/HepMCUtils.h has been moved to GenEvent package. A dummy file is
-   kept for backwards compatibility, forwarding to the new include
-
-! 2008-07-21 - Patrick Robbe
- - EvtGenDecay.cpp: add possibility to generate polarized charmonium
-
-! 2008-07-20 - Patrick Robbe
- - Special.cpp: suppress LHAPDF output
-
-!====================== Generators v8r2 2008-07-18 ===========================
-! 2008-07-18 - Patrick Robbe
- - Generation.cpp: fix compilation warning
-
-! 2008-07-16 - Gloria CORTI
- - Remove use of SEAL from requirements file
-
-! 2008-07-10 - Patrick Robbe
- - Remove completly SEAL functions and replace them with BOOST
-   functions for file handling
-   . src/component/EvtGenDecay.cpp/.h
-
-! 2008-07-09 - Patrick ROBBE and Gloria CORTI
- - Use Gaudi units explicitely instead of CLHEP implecitely via HepMC
-   (preparation for migration to HepMC 2.0)
- - Replace use of SEAL utility for environment variables with that of Gaudi
-   . src/component/BiasedBB.cpp
-   . src/component/DaughtersInLHCb.cpp
-   . src/component/EvtGenDecay.cpp
-   . src/component/Generation.cpp
-   . src/component/LHCbAcceptance.cpp
-   . src/component/LeptonInAcceptance.cpp
-   . src/component/ListOfDaughtersInLHCb.cpp
-   . src/component/ReadHepMCAsciiFile.cpp
-   . src/component/SelectedDaughterInLHCb.cpp
-   . src/component/WriteHepMCAsciiFile.cpp
-
-!====================== Generators v8r2 2008-07-06 ===========================
-! 2008-07-04 - Patrick Robbe
- - src/component/Inclusive.cpp: protect againts inexistent PDG Id for
-   inclusive production
-
-!====================== Generators v8r1 2008-06-09 ===========================
-! 2008-05-29 - Gloria CORTI
- - Modify code to pick Vector{3D,4D}Types, etc. from GaudiKernel since
-   LHCbDefinitions has been removed from GAUSS, given that the package
-   will no longer be used with Gauss DC06.
-   . Generators/IBeamTool.h
-   . src/component/BiasedBB.cpp
-   . src/component/DaughtersInLHCb.{h,cpp}
-   . src/component/EvtGenDecay.h
-   . src/component/FlatZSmearVertex.cpp
-   . src/component/ListOfDaughtersInLHCb.{h,cpp}
-   . src/component/SelectedDaughterInLHCb.{h,cpp}
-   . src/component/SignalForcedFragmentation.{h,cpp}
-   . src/component/UniformSmearVertex.cpp
-
-! 2008-05-23 - Patrick Robbe
- - Move Photos fortran files to GENSER
- - Remove unnecessary LHAPDF routines
-
-!====================== Generators v8r0 2008-05-06 ===========================
-! 2008-05-06 - Gloria CORTI
- - New algorithm to allow filtering of "merged" events, i.e. events where
-   a pp-collision is alwasys forced togheter with a MIB event, eg. beam
-   gas in Experimental area, in Long Straight Section or quartiary halo.
-   In this case two algorithms are executed one after the other and global
-   event cuts need to be applied afterward, since the one in "Generation" is
-   only applied on the event generated by the given instance of the algorithm.
-   . src/component/MergedEventsFilter.{h,cpp} - NEW
-
- - Introduce options to allow generation of pp-collisions elsewhere than
-   in IP8, for example in the center of the cavern. This can also be used
-   for interactions of satellite bunches.
-   Give mean z position of vertex as an option, "MeanZ" (Default = 0.0 as
-   in IP8, for center of the cavern it should be set to 11.22 m).
-   Can also set option to fix if time of interaction vs T0 of IP8 occured
-   before, after or at the same time, setting "SignOfTimeVsT0" (Default = 0.0
-   as in IP8, can be -1 or 1 in addition)
-   . src/component/BeamSpotSmearVertex.{h,cpp}
-
-! 2008-05-05 - Gloria CORTI
- - Introduce direction of beam to take into account that time of interaction
-   for beam 2 with beam gas has to be negative to have the beam arriving at
-   t = 0 in IP8. To allow for events where beam 1 and beam 2 are togheter
-   the "BeamDirection" can be set to "dummy" zero value in which case the
-   time of interaction is set to zero. The option is called "BeamDirection"
-   and can have integer values -1, 1 and 0 (Default = 1, as for beam 1)
-   . src/component/FlatZSmearVertex.{h,cpp}
-   . src/component/UniformSmearVertex.{h,cpp}
-
-! 2008-03-20 - Gloria CORTI
- - Temporarly exclude from library MuXMaxBias.cpp because of compilation
-   problems
-   . cmt/requirements
- - Put time of vertex as z/c, assuming these smearing are used for beam
-   gas so the time on which the occur is the time the beam has travelled
-   at that z from IP.
-   . src/component/FlatZSmearVertex.cpp, UniformSmearVertex.cpp
-
-! 2008-03-16 - Patrick Robbe
- - src/Lib/pyr.F: move to GENSER package
-
-! 2008-01-25 - Patrick Robbe
- - Special.cpp: set pile-up generation tool as a private tool
-
-!====================== Generators v7r7 2007-12-19 ===========================
-! 2007-12-06 - Vanya BELYAEV
- - src/Lib/ExternalGenerator.cpp
-   src/Lib/Signal.cpp
-   Allow the production of inclusive taus with SignalPlain tool
-
-!====================== Generators v7r6 2007-12-06 ===========================
-! 2007-11-30 - Gloria Corti
- - On Win32 put Signal and ExternalGenerators base classes in component
-   library rather then linker to allow compilation.
-   . requirements
-
-!====================== Generators v7r6 2007-12-06 ===========================
-! 2007-11-26 - Chris Jones
- - Add three new Signal selection 'Cut' tools
-  + SignalIsFromBDecay      : Selects only decays that originate from a b
-  + LHCbAcceptanceAndFromB  : The AND of the SignalIsFromBDecay and
-    LHCbAcceptance selections
-  + DaughtersInLHCbAndFromB : The AND of the SignalIsFromBDecay and
-    DaughtersInLHCb selections
-
-! 2007-11-08 - Gloria Corti for Karl Harrison
- - Linking of HepMCfio for WIN32
-
-! 2007-10-11 - Patrick Robbe
- - Move inline functions in StreamForGenerator and RandomForGenerator in
-   the .cpp files
-
-!====================== Generators v7r5 2007-10-11 ===========================
-! 2007-10-11 - Gloria Corti
- - Really add src/component/UniforSmearVertex.{h,cpp}
-
-! 2007-10-10 - Patrick Robbe
- - Add static class to hold external Gaudi random generator and message
-   stream to interface with Pythia and EvtGen
-   . Generators/StreamForGenerator.h, src/Lib/StreamForGenerator.cpp
-   . Generators/RandomForGenerator.h, src/Lib/RandomForGenerator.cpp
-   . src/Lib/EvtReport.cpp
-   . src/component/EvtGenDecay.cpp
-   . src/component/Generation.cpp
-
-!====================== Generators v7r4 2007-09-27 ===========================
-! 2007-09-27 - Gloria Corti for Massimiliano Ferro-Luzzi
- - Add new tool for uniform distribution in z and xy (within max radius)
-   of primary vertex
-   . src/component/UniformSmearVertex.{h,cpp} - NEW
-   . src/component/Generators_load.cpp - add factory also for other vertex
-                                         smearing tools that were missing
-                                         (Necessary for DC06 compatibility)
-
-! 2007-09-11 - Patrick Robbe
- - src/Lib/GenCounters.cpp: fix problem with D counters
-
-! 2007-09-09 - Patrick Robbe
- - src/component/SignalForcedFragmentation: fix problem with particles
-   already decayed (bug introduced when fixing CP violation with other
-   generation methods).
- - src/Lib/Signal.cpp: change name of iterators in nested loops for Windows
-   compilation.
- - src/Lib/LHAPDFCommonBlocks.cpp, LHAPDFUtils.F: rename routine whose names
-   are used in the new LHAPDF version
- - Various fixes for Windows compilation:
-   . StandAloneDecayTool.h
-   . EvtGenDecay.{h,cpp}
-
-!====================== Generators v7r3 2007-08-22 ===========================
-! 2007-07-17 - Patrick Robbe
- - src/Lib/Signal.cpp: fix generation of clean events
-
-!====================== Generators v7r2 2007-07-03 ===========================
-! 2007-07-03 - Gloria Corti
- - Allow possibility of running different instances of Generation algorithm
-   (ex. pp collisions and p-gas) in the same job. To do this the collisions
-   and hepmc events are kept in temporary containers and contents added to
-   containers in TES that are created in case they do not already exist.
-   The header information is updated accordingly.
-   . src/component/Generation.cpp
-
-! 2007-06-29 - Vanya BELYAEV
- - Generators/F77Utils.h, src/Lib/F77Utils.h
-     a) add  new function F77Utils::getUnit to obtain free FORTRAN unit
-        trrough scan of all available units between 99 and 10
-     b) for other function add optional argument "verbose"
-        with the default value equal to "false"(backward compatible).
-        It is *VERY* convinient for debugging...
- - src/Lib/f77units.F
-     add new function: INTEGER FUNCITON F77GETUNIT
-
-!====================== Generators v7r1 2007-05-08 ===========================
-! 2007-05-08 - Patrick Robbe
- - Clean cut tools to remove unused functions:
-    . src/component/DaughtersInLHCb.cpp
-    . src/component/DaughtersInLHCb.h
-    . src/component/ListOfDaughtersInLHCb.cpp
-    . src/component/ListOfDaughtersInLHCb.h
-    . src/component/SelectedDaughterInLHCb.cpp
-    . src/component/SelectedDaughterInLHCb.h
-
-! 2007-05-03 - Gloria CORTI
- - Slighlty change message levels at initialization to see in info()
-   primary interation vertex for flat vertex ( FlatZSmearVertex.cpp )
- - Explicitely use LHCbDefinitions so that package is compatible with
-   Gauss version using latest Gaudi v19r3 as well as DC06 version.
-
-! 2007-04-01 - Patrick Robbe
- - Add new tool (RepeatDecay) to re-use the same event several times,
-   calling only the decay phase.
-
-!====================== Generators v7r0 2007-03-13 ===========================
-! 2007-03-08 - Patrick Robbe
- - IProductionTool: Add new function "initializeGenerator()" which will
-   contain the generator specific initialization procedure.
- - ReadHepMCAsciiFile: adapt for new production tool interface
- - Special: Add the possibility to generate pile-up for special production
- - FixedLuminosityForRareProcess: new pile-up tool to generate correctly
-   pile-up distributions for rare process events
-
-! 2007-03-08 - Patrick Robbe for Thomas Blake
- - DiLeptonInAcceptance: new FullEventGenCutTool to accept events with dimuons.
-
-! 2007-02-27 - Patrick Robbe
- - Fix output level of Special production tool
-
-! 2007-02-23 - Gloria Corti
- - Increase major version due to change in IGenCutTool interface
-
-! 2007-02-22 - Gloria CORTI
- - Change default values of ZMin and ZMax of flat primary vertex according
-   to what chosen for Luminosity studies for beam gas (+/- 1500 mm) as
-   communicated by Daniele GREGORI
-   . FlatZSmearVertex.cpp
-
-! 2007-02-20 - Patrick Robbe
- - Fix efficiency counters for CP violation decay modes (=> change IGenCutTool
-   applyCut function arguments). The signal decay is now always performed
-   before applying any generator cut.
-
-!====================== Generators v6r8 2007-02-08 ===========================
-! 2007-02-08 - Gloria Corti
- - Slighlty change message levels at initialization to see beam energy and
-   primary interation vertex ( CollidingBeams.cpp, FixedTarget.cpp,
-   BeamSpotSmearVertex.cpp, FixedNInteractions.cpp)
-
-! 2007-02-06 - Patrick Robbe
- - Fix problem with biased hadron fractions (SignalPlain and
-   SignalRepeatedHadronization)
-
-! 2007-01-30 - Patrick Robbe
- - Fix problem with flip by EvtGen in Cut tools (DaughtersInLHCb,
-   SelectedDaughtersInLHCb and ListOfDaughtersInLHCb)
-
-! 2007-01-23 - Gloria Corti
- - Modify requirements to have a version with all changes in code but
-   compatible with DC06.
- - Change default for flat smearing of primary vertex, to have correct values
-   at 7 TeV for beam gas, i.e. 100 microns in x and y
-
-! 2007-01-08 - Florence Ranjard
- - update in many *.cpp to use new FACTORY and SystemOfUnits from GaudiKernel
-
-!====================== Generators v6r7p1 2006-12-04 =========================
-! 2006-11-30 - Vanya BELYAEV
- - src/componet/Generation.cpp
-   add a guard for "0 != m_pileUpTool" in
-   Generation::finalize method
-
-!======================= Generators v6r7 2006-11-09 ==========================
-! 2006-10-31 - Patrick Robbe
- - src/Lib/Signal.cpp: fix unitialized variable.
-
-! 2006-10-25 - Vanya BELYAEV
- - src/component/DumpHepMCTree.cpp
-     simple algorithm to dump the HepMC-tree in readable format
- - src/component/DumpMCDecay.h, src/component/DumpMCDecay.cpp
-     reshuffling of lines to allow the reuse functionality
-     in DumpHepMCTree algorithm
- - src/component/Generators_load.cpp
-     add a factory for new algorithm
-
-!======================= Generators v6r6 2006-10-23 ==========================
-! 2006-10-23 - Patrick Robbe
- - src/component/ListOfDaugthersInLHCb.h/.cpp: cut on a list of
-   daughters of the signal to be in the acceptance.
-
-! 2006-10-19 - Vanya BELYAEV
- - src/component/DumpMCDecay.cpp
-     - improve the printout
-     - introduce benw property "MaxLevels" to represent the maximal
-       printout level pit is much more easier to debug now!]
-     - reshuffle the lines a bit
- - src/component/DumpMCDecay.h  - remove the file
-
-!======================= Generators v6r5 2006-10-10 ==========================
-! 2006-10-09 - Patrick Robbe
- - SelectedDaughterInLHCb: modify to be able to give more than
-   1 PID in list of daughters to select on.
-
-! 2006-10-06 - Vanya BELYAEV
- - src/component/ReadHepMCAsciiFile.cpp
-
-    Simple "production tool", which actually reads HepMC events
-    from  ascii input file. The tool could be useful to read
-    information from external generators, if their integration
-   into Gauss is impossible, difficult or not needed.
-
-   The tool has 2 properties:
-
-     - <c>Input</c>  : The name of input fiel in HepMC Ascii format
-                     ( the default value is <c>""</c> (empty string))
-     - <c>Rescale<c> : Boolean flag to rescal the input event from
-                      Pythia units to LHCb units.
-                      The default value is <c>true</c>.
- - src/component/WriteHepMCAsciiFile.cpp
-
-    Simple class to dump generators events in plain
-    output file in HepMC Ascii format. It coudl be used for portable
-    cross-transitions of events inbetween different degerators
-
-    The algorithm has 3 properties:
-
-     - <c>Input</c>  : The TES location of LHCb::HepMCEvent::Container
-               ( the default value is <c>LHCb::HepMCEventLocation::Default</c>)
-     - <c>Ouput</c>  : The name of output HepMC Ascii file.
-                      The file is opened in "new/overwrite" mode.
-                      ( the default value is <c>""</c> (empty string)
-     - <c>Rescale<c> : Boolean flag to rescal the event from
-                       LHCb units to Pythia units.
-                       The default value is <c>true</c>.
-
- - src/components/Generators_load.cpp
-      declare 2 new componenst
-
- - Generators/Scale.h, src/Lib/Scale.cpp
-     simple utility to scale HepMC event inbetween Pythia and LHCb units
-
-!======================= Generators v6r4 2006-10-05 ==========================
-! 2006-10-04 - Patrick Robbe
- - Add a new tool (SelectedDaughterInLHCb) to cut only on the daughters
-  of a single daughter of the signal particle (for example daughter
- from a J/psi, Ds, ...), and require they are in the LHCb acceptance.
-
-! 2006-10-04 - Vanya BELYAEV
-
- - Generators/F77Utils.h
-       new file with few C++ utilities to manipulate(open&close) FORTRAN file
-      (Old/New/Unknown & their "Formatted" counterpartters)
- - src/Lib/F77Utils.cpp
- - src/Lib/f77units.F
-      Implementation of the functions from the file Generators/F77Utils.h
- - cmt/requirements
-      version incrmeent to v6r4
-
-
-! 2006-10-01 - Patrick Robbe
- - Add possibility to cut on daughters of signal particle (New
-   DaughtersInLHCb cut tool). Change of IGenCutTool interface to
-   allow this.
-
-!======================= Generators v6r3 2006-09-19 ==========================
-! 2006-09-06 - Gloria Corti
- - Generators/GenCounters.h: put explicitely include of <cmath> to compile
-   on slc4
-
-! 2006-08-30 - Patrick Robbe
- - src/Lib/phocin.F: put XPHCUT in double precision explicitly
-
-!======================= Generators v6r2 2006-08-29 ==========================
-! 2006-08-28 - Patrick Robbe
- - src/component/Generation.cpp: protect against b quark without production
-   vertex.
- - src/Lib/ExternalGenerator.cpp: order HepMC particles to be sure to
-   reproduce events.
- - src/component/StandAloneDecayTool.cpp: add a flag (Inclusive) to
-   be able to generate generic decays with the decay tool.
-
-!======================= Generators v6r1 2006-07-27 ==========================
-! 2006-07-27 - Gloria CORTI
- - Move update of EventType in GenHeader at beginning of execution to allow
-   production tools to access its value.
-   . src/component/Generation.cpp
-
-!=================== Generators v6r0 2006-07-04 ===========================
-! 2006-07-04 - Gloria CORTI
- - Introduce use of Gaudi::Units namespace as required by LHCb v21r1
-   . BeamSpotSmearVertex.cpp, EvtGenDecay.cpp, FlatZSmearVertex.cpp
- - Follow general LHCb convention for name of componenet libraries
-   loading and declaration file.
-   . factories declared in Generators_load.cpp (modified)
-   . remove Generators_entries.cpp and add Generators_dll.cpp
-
-!=================== Generators v5r3 2006-06-22 ===========================
-! 2006-06-22 - Gloria CORTI
- - Always print Event type code requested at initialization
-   . src/component/Generation.cpp
-
-! 2006-06-16 - Patrick Robbe
- - src/Lib/ExternalGenerator.cpp: set default value for job option
-   parameter (not in constructor).
-
-!=================== Generators v5r2 2006-06-07 ===========================
-! 2006-06-05 - Patrick Robbe
- - src/Lib/EVLCTEQ.F: Fix use of uninitialized value.
- - src/component/BiasedBB.h/.cpp : new cut tool to implement maximum
-   bias b/bbar sample for DC06.
- - src/component/Generators_entries.cpp: declare new cut tol BiasedBB.
- - src/component/SignalForcedFragmentation: Use ns for HepMC unit
-
-!=================== Generators v5r1 2006-05-19 ===========================
-! 2006-05-08 - Vanya BELYAEV
- - src/component/MuXMaxBias.cpp
-    really commit new tool..
- - cmt/requirement
-    (re)add the usage of Phys/LoKiGen v*
-
-! 2006-05-02 - Patrick Robbe
- - src/Lib/Signal.cpp: rename counters to be consistent with inclusive.
-
-! 2006-04-23 - Patrick Robbe
- - Add new tool to use EvtGen in standalone mode: StandAloneDecayTool
-
-! 2006-04-08 - Vanya BELYAEV
- - src/component/MuXMaxBias.cpp
-   new tool ("generator cut") for the
-   selection of "maximum bias sample for Bs -> mu+ mu- backhround studies"
- - src/component/Generators_entries.cpp
-   new tool is declared
- - cmt/requirement
-   add the usage of Phys/LoKiGen v*
-
-!=================== Generators v5r0 2006-04-07 ===========================
-! 2006-04-06 - Patrick Robbe
- - SignalForcedFragmentation: Fix counters.
- - GenCounters: do not count Bc with D hadrons.
-
-! 2006-04-05 - Patrick Robbe
- - requirements: GENSER 1.3.0 compiles now LHAPDF with -O2, remove
-   -O in requirements
-
-! 2006-04-04 - Patrick Robbe
- - ExternalGenerators.h/.cpp: add a switch (KeepOriginalProperties) in
-   options to be able to keep the original particle properties of the
-   external generator.
- - StringParse.h/.cpp: returns a double instead of a float when decoding
-   job option commands.
- - requirements: use "-O" flag to compile LHAPDF code instead of -O2.
- - Generation.cpp: improve counting of B hadrons
-
-! 2006-04-04 - Gloria CORTI
- - Adapt to changes in put method signature in GaudiAlgorithm base class
-   . src/Lib/Signal.cpp
-   . src/component/Generation.cpp
-
-! 2006-03-29 - Florence Ranjard
- - use HepMC from lcg/external : link with HepMCfio
-
-!=================== Generators v4r2 2006-03-22 ===========================
-! 2006-03-22 - Patrick Robbe
- - ExternalGenerators: adapt to new HepMCEvent constructor and set to false
-   isSignal for pile up collisions
- - Signal: use new HepMCEvent constructor and set HepMC container name of
-   clean events.
- - BeamSpotSmearVertex, FlatZSmearVertex: use mm
- - EvtGenDecay: use MeV and interface EvtGen engine with GeV in the tool
- - Inclusive: set IsSignal flag of collision containing the inclusive type.
- - LeptonInAcceptance: use MeV
- - SignalPlain, SignalForcedFragmentation, SignalRepeatedHadronization,
-   Special: set IsSignal flag for collision with signal.
-
-!=================== Generators v4r1 2006-03-16 ===========================
-! 2006-03-12 - Patrick Robbe
- - Generation: fix interaction counters to count direct B from protons
-   as b quark.
-
-! 2006-03-07 - Patrick Robbe
- - phocin: set up PHOTOS to work with more than 2 charged tracks
-   and interferences
- - SignalPlain: add counters
-
-! 2006-02-22 - Patrick Robbe
- - requirements: use names with double underscore
- - ExternalGenerator, EvtGenDecay: use names with __
- - GenCounters: fix counter when there is a B oscillating
- - Signal: use end vertex as signal process
- - Generation: number HepMC::GenEvent with pile up number
-
-! 2006-02-17 - Patrick Robbe
- - HepMCUtils: add utility functions to help with HepMC structures.
- - ExternalGenerator: change decay heavy particle methods to be able
-     to reproduce events.
- - Signal: add counters of excited states and B hadron types,
-     fix clean events.
- - EvtReport, EvtGenDecay: fix overload of EvtGen output facility.
- - GenCouters: add counters for signal event types.
- - DumpMC: order particles when printing them.
- - Generation: improve reproducibility of events.
- - Inclusive, Signal...: use new function to decay heavy particles.
-
-! 2006-02-07 - Patrick Robbe
- - EvtGenDecay: finalize random generator at destruction of EvtGenGaudiRandom
- - LHAPdf interface: fix memoty leaks
-
-! 2006-02-06 - Patrick Robbe
- - Generation: fix problem with HepMCEvents (crashing for inclusive and
-       signal productions)
- - GenCounters: add several utility functions to handle array of counters.
-
-! 2006-02-05 - Patrick Robbe
- - requirements: use SEAL
- - Generation: use arrays to contain counters
- - Use temporary file class from SEAL to make temporary files.
-
-! 2006-02-01 - Patrick Robbe
- - ExternalGenerator and src/Lib/EVLCTEQ.F: remove warnings when not in DEBUG
-     mode for LHAPDF.
- - Remove includes of CLHEP SystemOfUnits
-
-!=================== Generators v4r0 2006-01-19 ===========================
-! 2006-01-19 - Gloria CORTI
- - Generation: do not create new GenHeader but unpdate info already in TES
-
-! 2006-01-18 - Patrick Robbe
- - ExternalGenerator: create HepMC::GenEvent by hand to store in
-   HepMCEvent
-
-! 2005-12-31 - Patrick Robbe
- - Adapt to new event model and new vector classes.
-
-! 2005-12-21 - Patrick Robbe
- - phocin.F: activate exponentiation in PHOTOS
- - GenCounters.h: print shorter fractions
-
-!=================== Generators v3r0 2005-12-15 ===========================
-! 2005-12-15 - Patrick Robbe
- - ExternalGenerator: Do not decay signal particle with status
-   code equal to 3.
-
-! 2005-12-10 - Patrick Robbe
- - Add comments for doxygen
-
-! 2005-12-08 - Patrick Robbe
- - Remove old structure
- - ExternalGenerators: allow possibility to change LHAPDF settings by job
-   option.
-
-! 2005-12-07 - Patrick Robbe
- - GenCounters.h: common functions to print counters and compute efficiencies
- - VariableLuminosity, Special, Generation, SignalPlain: use common function
-   to print counters.
- - SignalRepeatedHadronization: remove HepMCUtils dependency  and add
-   Clear function to clear content of HepMC Event
- - Inclusive: fix counters
- - ExternalGenerator: manage LHAPDF output and remove HepMC dependency
- - LHAPDFCommonBlocks.{h,cpp}: wrapper for LHAPDF common blocks
- - LhaPdf.{h,cpp}: static class to access LHAPDF functions from C++
- - LHAPDFUtils.F: Fortran functions to access LHAPDF common blocks
- - FixedLuminosity: new luminosity tool for fixed luminosity
-
-! 2005-11-29 - Patrick Robbe
- - LeptonInAcceptance: add full event cut tool to keep events with one
-   lepton with pT > 4 GeV
- - ExternalGenerator: add computation of efficiencies and counters
- - Signal, Generation, Inclusive, Special, VariableLuminosity: add print out
-   and computation of various counters
-
-! 2005-11-21 - Patrick Robbe
- - Signal.h/.cpp: add functions and counters to be able to compute
-   the generator level cut efficiencies. Each tool deriving from
-   "Signal" has to increment at the correct place these counters.
- - ExternalGenerator.cpp: use HepMC::GenEvent iterators (which are
-   sorted according to barcodes) in order to remove need to call
-   sort function (to reproduce events with HepMC)
- - IFullGenEventCutTool: add new tool to be able to cut on full event
-   properties.
- - Generation.cpp:
-       . sort GenParticles when using HepMC::GenParticle
-         iterators (which are not sorted) according to the barcode.
-       . use new Full event cut tool
- - SignalPlain, SignalForcedFragmentation, SignalRepeatedHadronization:
-   increment counters to compute generator level cut efficiencies.
-
-! 2005-11-17 - Patrick Robbe
- - src/component/Signal*.cpp : add possibility to generate clean events
- - src/component/SignalForcedFragmentation: add forced fragmentation
-   method
- - src/component/Special.cpp : add special generation method.
-
-!========================= Generators v2r1 ===========================
-! 2005-11-07 - Patrick Robbe
- - src/Lib/EvtReport.cpp: add function to overwrite EvtGen printing
-   utilities.
- - EvtGenDecay: use this new function.
- - ExternalGenerator and IProductionTool: set particle properties from
-   ParticlePropertySvc.
-
-! 2005-11-04 - Patrick Robbe
- - src/component/SignalRepeatedHadronization.h/cpp: tool to generate
-   signal events with repeated hadronization.
- - ExternalGenerator: add utility function to deal with event model
-   classes and prepare them before each generation of interactions.
- - HepMCUtils: add function to clear HepMC events
- - IProductionTool: add virtual functions for repeated hadronization
-   method.
- - Signal: add utility functions (choose one B amongst several and
-   function to choose correct signal multiplicity).
- - phocin.F: adapt for PHOTOS 2.15
- - pythiaoutput_utils.F : adapt for PYTHIA 6.3
- - Generation: correct status of particles to decay with EvtGen.
-
-!========================= Generators v2r0 ===========================
-! 2005-10-17 - Patrick Robbe
- - EvtGenTool : add possibility to control polarization parameters
-   by job options.
-
-! 2005-10-13 - Patrick Robbe
- - Generators/GenBaseAlg : remove forward declaration not used
-
-! 2005-10-03 - Patrick Robbe
- - HepMCUtils : use a static class instead of a namespace and add
-   IsBAtProduction utility function.
- - EvtDecayAlg : use new name of sort function.
- - EvtGenTool : declare global stream variable extern to avoid conflicts
- - Generators/IBeamTool.h : New abstract interface to tools to obtain beam
-     parameters in generator interfaces.
- - Generators/IDecayTool.h : New abstract interface to decay generators.
- - Generators/IGenCutTool.h : New abstract interface to generator level cut
-     tools.
- - Generators/IPileUpTool.h : New abstract interface to tools computing the
-     number of pile up interactions.
- - Generators/IProductionTool.h : New abstract interface to production
-     generators.
- - Generators/ISampleGenerationTool.h : New abstract interface to tools
-     producing the different samples.
- - Generators/IVertexSmearingTool.h : New abstract interface to vertex smearing
-     tools.
- - VariableLuminosity: pile up tool to decide the number of pile up
-     interactions depending on the current luminosity.
- - FixedNInteractions: pile up tool with fixed number of interactions per
-     event.
- - CollidingBeams: Beam tool for colliding beams and beam smearing
- - FixedTarget: Beam tool for fixed target
- - BeamSpotSmearVertex: vertex smearing tool for gaussian smearing.
- - FlatZSmearVertex: vertex smearing with flat Z distribution.
- - LHCbAcceptance: generator level cut tool with angular cut.
- - ExternalGenerator: base class for sample generation tool using an
-     external generator.
- - Signal: base class for sample generation tool using an external generator
-     and generating signal samples.
- - EvtGenDecay: Decay tool interfacing EvtGen
- - Generation: Main algorithm steering production of event samples with an
-     external generator.
- - MinimumBias: Sample generation tool to generate minimum bias.
- - Inclusive: Sample generation tool to generate inclusive events.
- - SignalPlain: Sample generation tool to generate signal events with plain
-     method.
-
-!========================= Generators v1r2 ===========================
-! 2005-08-22 - Florence RANJARD
- - phocin.F - remove the #include nmxhep.inc, replace it with 10000.
-
-!========================== Generators v1r1 ===========================
-! 2005-07-11 - Gloria CORTI
- - requirements: introduce macro for fortran flags (no second underscore)
-
-! 2005-06-24 - Gloria CORTI
- - Import changes as done in GeneratorModules v15r3 for merging of
-   beam gas with min bias events
-  + Changes to add possibility to set with properties the Generator data
-   paths in the TES. By defaut they are set to XxxLocation::Default
-   . src/component/EvtDecayAlg.{h,cpp} - property "HepMCEventLocation"
-   . src/component/SetDecayAlg.{h,cpp} - property "HepMCEventLocation"
-   . src/component/SmearVertexAlg.{h,cpp} - property "HepMCEventLocation"
-   . Generators/GenBaseAlg.h
-     src/Lib/GenBaseAlg.cpp - property "HepMCEventLocation"
-                              property "HardInfoLocation"
-                              property "GenHeaderLocation"
-  + Changes to add possibility to apply smearing of primary vertex only
-   to events produced with a certain generator (identified by name in
-   HepMCEvent container). Controlled by setting name of generator in
-   property "ApplyTo". The default is set to an empty string, in which
-   case the smearing is applied to all events in container
-   . src/component/SmearVertexAlg.{h,cpp}
-
-
-!========================== Generators v1r0 ===========================
-! 2005-06-20 - Patrick Robbe
- - new package. This package contains the base classes used by the
-   generator algorithms and tools. It also contains generic algorithms
-   and tools for debugging (DumpMC, DumpMCDecay), for EvtGen access
-   (EvtGenTool, SetDecayAlg, EvtDecayAlg), for vertex smearing (SmearVertexAlg)
-   and also utility functions (random number interfaces, HepMC help functions,
-   String utilities to read generator Fortran-like options)
-
-! ====================================================================
diff --git a/Gen/Generators/src/Lib/EvtReport.cpp b/Gen/Generators/src/Lib/EvtReport.cpp
deleted file mode 100755
index ded6486fd1513dc161674f30be9f9e3d65165f73..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/EvtReport.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// $Id: EvtReport.cpp,v 1.3 2007-10-10 20:07:24 robbep Exp $
-// Overwrite EvtGen output messages
-
-#include "Generators/StreamForGenerator.h" 
-#include "EvtGenBase/EvtReport.hh"
-
-std::ostringstream dummyStr ;
-
-//=============================================================================
-// Reimplementation of print facility of EvtGen
-//=============================================================================
-std::ostream & report( Severity severity , const char * facility ) 
-{  
-  dummyStr.str("") ;
-  if ( severity < WARNING ) {
-    if ( 0 != facility[0] ) { 
-      (*StreamForGenerator::getStream()) << MSG::ERROR << facility << " Error from EvtGen" 
-                      << endmsg ; 
-    }
-    else (*StreamForGenerator::getStream()) << MSG::ERROR << "Error from EvtGen" 
-                         << endmsg ;
-  } else if ( severity < INFO ) {
-    if ( 0 != facility[0] ) {
-      (*StreamForGenerator::getStream()) << MSG::INFO ; 
-      if ( StreamForGenerator::getStream()->isActive() ) std::cout << facility << ":" ;
-    } else (*StreamForGenerator::getStream()) << MSG::INFO ;
-  } else {
-    if ( 0 != facility[0] ) {
-      (*StreamForGenerator::getStream()) << MSG::DEBUG ;
-      if ( StreamForGenerator::getStream()->isActive() ) std::cout << facility << ":" ;
-    } else ( *StreamForGenerator::getStream() ) << MSG::DEBUG ;
-  }
-  if ( StreamForGenerator::getStream()->isActive() ) return std::cout ;
-  else return dummyStr ;
-}
diff --git a/Gen/Generators/src/Lib/ExternalGenerator.cpp b/Gen/Generators/src/Lib/ExternalGenerator.cpp
deleted file mode 100755
index ad9c1570da13aa89653ad23fd8d7c73f9789609a..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/ExternalGenerator.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-// $Id: ExternalGenerator.cpp,v 1.27 2009-12-03 15:32:49 robbep Exp $
-// Include files 
-
-// local
-#include "Generators/ExternalGenerator.h"
-
-// Boost
-#include "boost/tokenizer.hpp"
-#include "boost/algorithm/string/erase.hpp"
-// Gaudi
-#include "Kernel/IParticlePropertySvc.h" 
-#include "Kernel/ParticleProperty.h"
-// Kernal
-#include "MCInterfaces/IGenCutTool.h"
-#include "MCInterfaces/IDecayTool.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "Generators/LhaPdf.h"
-#include "Generators/StringParse.h"
-#include "Generators/ICounterLogFile.h"
-#include "GenEvent/HepMCUtils.h"
-#include "Event/GenFSR.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : ExternalGenerator
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-ExternalGenerator::ExternalGenerator( const std::string& type,
-                                      const std::string& name,
-                                      const IInterface* parent )
-  : GaudiTool ( type, name , parent ) , 
-    m_productionTool( 0 ) ,
-    m_decayTool( 0 ) ,
-    m_cutTool  ( 0 ) , 
-    m_xmlLogTool( 0 ) ,
-    m_ppSvc    ( 0 ) { 
-    m_defaultLhaPdfSettings.clear() ;
-    declareInterface< ISampleGenerationTool >( this ) ;
-    declareProperty( "ProductionTool" , 
-                     m_productionToolName = "Pythia8Production" ) ; 
-    declareProperty( "DecayTool" , m_decayToolName = "EvtGenDecay" ) ;
-    declareProperty( "CutTool" , m_cutToolName = "LHCbAcceptance" ) ;
-    declareProperty( "LhaPdfCommands" , m_userLhaPdfSettings ) ;
-    declareProperty( "KeepOriginalProperties" , m_keepOriginalProperties = 
-                     false ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-    m_defaultLhaPdfSettings.push_back( "lhacontrol lhaparm 17 LHAPDF" ) ;
-    m_defaultLhaPdfSettings.push_back( "lhacontrol lhaparm 16 NOSTAT" ) ;
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-ExternalGenerator::~ExternalGenerator( ) { ; }
-
-//=============================================================================
-// Initialization method
-//=============================================================================
-StatusCode ExternalGenerator::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  if ( msgLevel( MSG::DEBUG ) ) {
-    LhaPdf::lhacontrol().setlhaparm( 19 , "DEBUG" ) ;
-  }
-  else {
-    LhaPdf::lhacontrol().setlhaparm( 19 , "SILENT" ) ;
-  }
-  
-  // Set default LHAPDF parameters:
-  sc = parseLhaPdfCommands( m_defaultLhaPdfSettings ) ;
-  // Set user LHAPDF parameters:
-  sc = parseLhaPdfCommands( m_userLhaPdfSettings ) ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Unable to read LHAPDF commands" , sc ) ;
-
-  // retrieve the particle property service
-  m_ppSvc = svc< LHCb::IParticlePropertySvc >( "LHCb::ParticlePropertySvc" , true ) ;
-
-  // obtain the Decay Tool 
-  // (ATTENTION: it has to be initialized before the production tool)
-  if ( "" != m_decayToolName ) 
-    m_decayTool = tool< IDecayTool >( m_decayToolName ) ;
-
-  // obtain the Production Tool
-  if ( "" != m_productionToolName ) 
-    m_productionTool = tool< IProductionTool >( m_productionToolName , this ) ;
-
-  // update the particle properties of the production tool
-  if ( 0 != m_productionTool ) {
-    LHCb::IParticlePropertySvc::iterator iter ;
-    for ( iter = m_ppSvc -> begin() ; iter != m_ppSvc -> end() ; ++iter ) {
-      if ( ( ! m_productionTool -> isSpecialParticle( *iter ) ) && 
-           ( ! m_keepOriginalProperties ) ) 
-        m_productionTool -> updateParticleProperties( *iter ) ;
-      // set stable in the Production generator all particles known to the
-      // decay tool
-      if ( 0 != m_decayTool )
-        if ( m_decayTool -> isKnownToDecayTool( (*iter)->pdgID().pid() ) ) 
-          m_productionTool -> setStable( *iter ) ;    
-    }
-  }
-
-  // obtain the cut tool
-  if ( "" != m_cutToolName ) 
-    m_cutTool = tool< IGenCutTool >( m_cutToolName , this ) ;
-
-  if ( 0 != m_productionTool ) 
-    m_productionTool -> initializeGenerator();
-
-  // obtain the log tool
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  // now debug printout of Production Tool 
-  // has to be after all initializations to be sure correct values are printed
-  if ( 0 != m_productionTool ) { 
-    m_productionTool -> printRunningConditions( ) ;  
-    
-    boost::char_separator<char> sep(".");
-    boost::tokenizer< boost::char_separator<char> > 
-      strList( m_productionTool -> name() , sep ) ;
-
-    
-    std::string result = "" ;
-    for ( boost::tokenizer< boost::char_separator<char> >::iterator 
-            tok_iter = strList.begin();
-          tok_iter != strList.end(); ++tok_iter)
-      result = (*tok_iter) ;
-    m_hepMCName = boost::algorithm::ierase_last_copy( result , "Production" ) ;
-  } else {
-    m_hepMCName = "DecayAlone" ;
-  }
-
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Decay heavy excited particles
-//=============================================================================
-StatusCode ExternalGenerator::decayHeavyParticles( HepMC::GenEvent * theEvent,
-     const LHCb::ParticleID::Quark theQuark , const int signalPid ) const {
-  StatusCode sc ;
-  
-  if ( 0 == m_decayTool ) return StatusCode::SUCCESS ;
-
-  m_decayTool -> disableFlip() ;
-
-  HepMCUtils::ParticleSet particleSet ;  
-
-  HepMC::GenEvent::particle_iterator it ;
-  switch ( theQuark ) {
-    
-  case LHCb::ParticleID::bottom: // decay only B
-    for ( it = theEvent -> particles_begin() ; 
-          it != theEvent -> particles_end() ; ++it )
-      if ( LHCb::ParticleID( (*it) -> pdg_id() ).hasQuark( theQuark ) ) 
-        particleSet.insert( *it ) ;
-    break ;
-    
-  case LHCb::ParticleID::charm: // decay B + D
-    for ( it = theEvent -> particles_begin() ;
-          it != theEvent -> particles_end() ; ++it ) {
-      LHCb::ParticleID pid( (*it) -> pdg_id() ) ;
-      if ( ( pid.hasQuark( theQuark ) ) || 
-           ( pid.hasQuark( LHCb::ParticleID::bottom ) ) ) 
-        particleSet.insert( *it ) ;
-    }
-    break ;
-    
-  default:
-    
-    if ( 15 == LHCb::ParticleID(signalPid).abspid() ) // tau ?
-    {
-      for ( it = theEvent -> particles_begin() ;
-            it != theEvent -> particles_end() ; ++it ) {
-        LHCb::ParticleID pid( (*it) -> pdg_id() ) ;
-        if ( ( pid.hasQuark( LHCb::ParticleID::charm  ) ) || 
-             ( pid.hasQuark( LHCb::ParticleID::bottom ) ) ) 
-          particleSet.insert( *it ) ;
-      }
-      break ; 
-    }
-    else 
-    {
-      // decay all what is heavier than the signal
-      for ( it = theEvent -> particles_begin() ;
-            it != theEvent -> particles_end() ; ++it ) {
-        LHCb::ParticleID pid( (*it) -> pdg_id() ) ;
-        if ( (*it) -> generated_mass() > 
-             m_ppSvc -> find( LHCb::ParticleID( signalPid ) ) -> mass() )
-          particleSet.insert( *it ) ;
-        // if signal is KS then decay also K0
-        else if ( ( signalPid == 310 ) && ( pid.abspid() == 311 ) )
-          particleSet.insert( *it ) ;
-      }      
-    }
-    break ; 
-  }
-  
-  for ( HepMCUtils::ParticleSet::iterator itHeavy = particleSet.begin() ; 
-        itHeavy != particleSet.end() ; ++itHeavy ) 
-    
-    if ( ( LHCb::HepMCEvent::StableInProdGen == (*itHeavy) -> status() ) && 
-         ( signalPid != abs( (*itHeavy) -> pdg_id() ) ) ) {
-      
-      if ( m_decayTool -> isKnownToDecayTool( (*itHeavy) -> pdg_id() ) ) {
-        sc = m_decayTool -> generateDecayWithLimit( *itHeavy , signalPid ) ;
-        if ( ! sc.isSuccess() ) return sc ;
-      } 
-    }
-  
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Check the presence of a particle of given type in event
-// Attention : pidList must be sorted before begin used in this function
-//=============================================================================
-bool ExternalGenerator::checkPresence( const PIDs & pidList ,
-                                       const HepMC::GenEvent * theEvent ,
-                                       ParticleVector & particleList ) const {
-  particleList.clear( ) ;
-  HepMC::GenEvent::particle_const_iterator it ;
-  for ( it = theEvent -> particles_begin() ; 
-        it != theEvent -> particles_end() ; ++it ) 
-    if ( std::binary_search( pidList.begin() , pidList.end() ,
-                             (*it) -> pdg_id() ) ) 
-      if ( ( LHCb::HepMCEvent::DocumentationParticle != (*it) -> status() ) 
-           && ( HepMCUtils::IsBAtProduction( *it ) ) )
-        particleList.push_back( *it ) ;
-
-  std::sort( particleList.begin() , particleList.end() , 
-             HepMCUtils::compareHepMCParticles ) ;
-
-  return ( ! particleList.empty() ) ;
-}
-
-//=============================================================================
-// invert the event
-//=============================================================================
-void ExternalGenerator::revertEvent( HepMC::GenEvent * theEvent ) const {
-  HepMC::GenEvent::vertex_iterator itv ;
-  double x, y, z, t ;
-  for ( itv = theEvent -> vertices_begin() ;
-        itv != theEvent -> vertices_end() ; ++itv ) {
-    x = (*itv) -> position().x() ;
-    y = (*itv) -> position().y() ;
-    z = (*itv) -> position().z() ;
-    t = (*itv) -> position().t() ;
-    (*itv) -> set_position( HepMC::FourVector( x, y, -z, t ) ) ;
-  }
-
-  HepMC::GenEvent::particle_iterator itp ;
-  double px, py, pz, E ;
-  for ( itp = theEvent -> particles_begin() ;
-        itp != theEvent -> particles_end() ; ++itp ) {
-    px = (*itp) -> momentum().px() ;
-    py = (*itp) -> momentum().py() ;
-    pz = (*itp) -> momentum().pz() ;
-    E  = (*itp) -> momentum().e() ;
-    (*itp) -> set_momentum( HepMC::FourVector( px, py, -pz, E ) ) ;
-  }      
-}
-
-//=============================================================================
-// count the number of particles with pz > 0
-//=============================================================================
-unsigned int ExternalGenerator::nPositivePz( const ParticleVector 
-                                             & particleList ) const {
-  ParticleVector::const_iterator iter ;
-  unsigned int nP = 0 ;
-  for ( iter = particleList.begin() ; iter != particleList.end() ; ++iter ) 
-    if ( (*iter)->momentum().pz() > 0 ) nP++ ;
-  
-  return nP ;
-}
-
-
-//=============================================================================
-// Set up event
-//=============================================================================
-void ExternalGenerator::prepareInteraction( LHCb::HepMCEvents * theEvents ,
-    LHCb::GenCollisions * theCollisions , HepMC::GenEvent * & theGenEvent ,  
-    LHCb::GenCollision * & theGenCollision ) const {
-  LHCb::HepMCEvent * theHepMCEvent = new LHCb::HepMCEvent( ) ;
-  theHepMCEvent -> setGeneratorName( m_hepMCName ) ;
-  theGenEvent = theHepMCEvent -> pGenEvt() ;
-
-  theGenCollision = new LHCb::GenCollision() ;  
-  theGenCollision -> setEvent( theHepMCEvent ) ;
-  theGenCollision -> setIsSignal( false ) ;
-
-  theEvents -> insert( theHepMCEvent ) ;
-  theCollisions -> insert( theGenCollision ) ;
-}
-
-//=============================================================================
-// Parse LHAPDF commands stored in a vector
-//=============================================================================
-StatusCode ExternalGenerator::parseLhaPdfCommands( const CommandVector & 
-                                                   theCommandVector ) const {
-  //
-  // Parse Commands and Set Values from Properties Service...
-  //
-  CommandVector::const_iterator iter ;
-  for ( iter = theCommandVector.begin() ; theCommandVector.end() != iter ; 
-        ++iter ) {
-    debug() << " Command is: " << (*iter) << endmsg ;
-    StringParse mystring( *iter ) ;
-    std::string block = mystring.piece(1);
-    std::string entry = mystring.piece(2);
-    std::string str   = mystring.piece(4);
-    int    int1  = mystring.intpiece(3);
-    double fl1   = mystring.numpiece(3);
-    
-    // Note that Pythia needs doubles hence the convert here
-    debug() << block << " block  " << entry << " item  " << int1 
-            << "  value " << fl1 << " str " << str << endmsg ;
-    if ( "lhacontrol" == block )  
-      if      ( "lhaparm" == entry ) 
-        LhaPdf::lhacontrol().setlhaparm( int1 , str ) ;
-      else if ( "lhavalue" == entry ) 
-        LhaPdf::lhacontrol().setlhavalue( int1 , fl1 ) ;
-      else return Error( std::string( "LHAPDF ERROR, block LHACONTROL has " ) +
-                         std::string( "LHAPARM and LHAVALUE: YOU HAVE " ) + 
-                         std::string( "SPECIFIED " ) + std::string( entry ) ) ;
-    else return Error( std::string( " ERROR in LHAPDF PARAMETERS   " ) +
-                       std::string( block ) +
-                       std::string( " is and invalid common block name !" ) ) ;
-  }
-  
-  return StatusCode::SUCCESS ;
-}
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode ExternalGenerator::finalize( ) {
-  if ( 0 != m_decayTool ) release( m_decayTool ) ;
-  if ( 0 != m_productionTool ) release( m_productionTool ) ;
-  if ( 0 != m_cutTool ) release( m_cutTool ) ;
-  if ( 0 != m_ppSvc ) release( m_ppSvc ) ;
-
-  // set the name of the method
-  m_xmlLogTool -> addMethod( this -> name() ) ;
-  // set the name of the generator
-  m_xmlLogTool -> addGenerator( m_hepMCName ) ;
-
-  return GaudiTool::finalize() ;
-}
diff --git a/Gen/Generators/src/Lib/F77Utils.cpp b/Gen/Generators/src/Lib/F77Utils.cpp
deleted file mode 100755
index 3bb6dc8b890e2d558a71fc3fb8b2d58ab98f5079..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/F77Utils.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-// $Id: F77Utils.cpp,v 1.2 2007-06-29 13:21:06 ibelyaev Exp $
-// ============================================================================
-// Include files
-// ============================================================================
-// STD & STL 
-// ============================================================================
-#include <ctype.h>
-#include <iostream>
-// ============================================================================
-// Generators 
-// ============================================================================
-#include "Generators/F77Utils.h"
-// ============================================================================
-/** @file 
- *  Implementation file for functionf from namespace F77Units
- *  @date 2006-10-03 
- *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
- */
-// ============================================================================
-//  Open Fortran file with status="UNKNOWN" 
-// ============================================================================
-StatusCode F77Utils::open 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{ return openUnknown ( lun , file , verbose ) ; }
-// ============================================================================
-// Open "FORMATTED" Fortran file with status="UNKNOWN" 
-// ============================================================================
-StatusCode F77Utils::openFormatted 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{ return openUnknownFormatted ( lun , file , verbose ) ; }
-// ============================================================================
-extern "C"
-{
-#ifdef WIN32 
-  int __stdcall F77CLFILE   (int* LUN );
-  int __stdcall F77ONFILE   (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77OOFILE   (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77OUFILE   (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77ONFFILE  (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77OOFFILE  (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77OUFFILE  (int* LUN ,const char* FILE, int LEN );
-  int __stdcall F77GETUNIT  (int* LUN ) ;
-#define f77clfile  F77CLFILE  
-#define f77onfile  F77ONFILE  
-#define f77oofile  F77OOFILE  
-#define f77oufile  F77OUFILE  
-#define f77onffile F77ONFFILE  
-#define f77ooffile F77OOFFILE  
-#define f77ouffile F77OUFFILE
-#define f77getunit F77GETUNIT
-#else 
-  int           f77clfile_  (int* LUN ) ;
-  int           f77onfile_  (int* LUN , const char* FILE, int LEN ) ;
-  int           f77oofile_  (int* LUN , const char* FILE, int LEN ) ;
-  int           f77oufile_  (int* LUN , const char* FILE, int LEN ) ;
-  int           f77onffile_ (int* LUN , const char* FILE, int LEN ) ;
-  int           f77ooffile_ (int* LUN , const char* FILE, int LEN ) ;
-  int           f77ouffile_ (int* LUN , const char* FILE, int LEN ) ;
-  int           f77getunit_ (int* LUN ) ;
-#define f77clfile  f77clfile_
-#define f77onfile  f77onfile_
-#define f77oofile  f77oofile_
-#define f77oufile  f77oufile_
-#define f77onffile f77onffile_
-#define f77ooffile f77ooffile_
-#define f77ouffile f77ouffile_
-#define f77getunit f77getunit_
-#endif 
-}
-// ==========================================================================
-// close the opened F77 file 
-// ==========================================================================
-StatusCode F77Utils::close ( int lun , const bool verbose ) 
-{ 
-  const int result = f77clfile( &lun )  ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::close()               ERROR Error in closing LUN=" 
-              << lun << std::endl ; 
-  }
-  else if ( verbose ) 
-  { 
-    std::cout << "F77Utils::close()               INFO  LUN=" 
-              << lun << " is closed " << std::endl ; 
-  }
-  return result != lun ?  StatusCode::FAILURE : StatusCode::SUCCESS ;
-} 
-// ==========================================================================
-// Open Fortran file with status="NEW" 
-// ==========================================================================
-StatusCode F77Utils::openNew 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77onfile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openNew               ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose ) 
-  {
-    std::cout << "F77Utils::openNew               INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-} 
-// ==========================================================================
-// Open Fortran file with status="OLD" 
-// ==========================================================================
-StatusCode F77Utils::openOld 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77oofile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openOld               ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose ) 
-  {
-    std::cout << "F77Utils::openOld               INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }  
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-} 
-// ==========================================================================
-// Open Fortran file with status="UNKNOWN" 
-// ==========================================================================
-StatusCode F77Utils::openUnknown 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77oufile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openUnknown           ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose ) 
-  {
-    std::cout << "F77Utils::openUnknown           INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }    
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-} 
-// ==========================================================================
-// Open "FORMATTED" Fortran file with status="NEW" 
-// ==========================================================================
-StatusCode F77Utils::openNewFormatted 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77onffile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openNewFormatted      ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose ) 
-  {
-    std::cout << "F77Utils::openNewFormatted      INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }    
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-}
-// ==========================================================================
-// Open "FORMATTED" Fortran file with status="OLD" 
-// ==========================================================================
-StatusCode F77Utils::openOldFormatted 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77ooffile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openOldFormatted      ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose ) 
-  {
-    std::cout << "F77Utils::openOldFormatted      INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }  
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-}
-// ==========================================================================
-// Open "FORMATTED" Fortran file with status="UNKNOWN" 
-// ==========================================================================
-StatusCode F77Utils::openUnknownFormatted 
-( int                lun     , 
-  const std::string& file    , 
-  const bool         verbose )  
-{
-  const int result = f77ouffile ( &lun , file.c_str() , file.size() ) ;
-  if ( result != lun ) 
-  { 
-    std::cerr << "F77Utils::openUnknownFormatted  ERROR Error in opening LUN=" << lun 
-              << " FILE='"<< file << "' "<< std::endl ; 
-  }
-  else if ( verbose )
-  {
-    std::cout << "F77Utils::openUnknownFormatted  INFO  LUN=" << lun 
-              << " FILE='"<< file << "' is opened "<< std::endl ; 
-  }  
-  return result != lun ? StatusCode::FAILURE : StatusCode::SUCCESS ;
-}
-// ==========================================================================
-// find free fortran unit
-// ==========================================================================
-int F77Utils::getUnit( const bool verbose ) 
-{
-  int n = 0 ;
-  const int result = f77getunit ( &n ) ;
-  if ( 0 >= result || 100 <= result ) 
-  {
-    std::cerr << "F77Utils::getUnit               ERROR No free units" << std::endl ;
-  } 
-  else if ( verbose )  
-  {
-    std::cout << "F77Utils::getUnit               INFO  Free unit LUN=" << result << std::endl ;
-  }
-  return result ;
-}
-// ==========================================================================
-
-
-
-// ============================================================================
-// The END 
-// ============================================================================
diff --git a/Gen/Generators/src/Lib/GenCounters.cpp b/Gen/Generators/src/Lib/GenCounters.cpp
deleted file mode 100755
index 29b11494062e5e47c74b4d5df8ee9804cb41e72a..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/GenCounters.cpp
+++ /dev/null
@@ -1,607 +0,0 @@
-// $Id: GenCounters.cpp,v 1.5 2007-09-11 17:48:32 robbep Exp $
-// Include files
-
-// local
-#include "Generators/GenCounters.h"
-
-// Generators
-#include "GenEvent/HepMCUtils.h"
-
-// Boost
-#include <boost/array.hpp>
-
-// HepMC
-#include "HepMC/GenEvent.h"
-
-// Event
-#include "Event/HepMCEvent.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// LHCb
-#include "Kernel/ParticleID.h"
-
-//=============================================================================
-// Function to test if a HepMC::GenParticle is a B hadron at root of decay
-//=============================================================================
-struct isRootB : std::unary_function< const HepMC::GenParticle * , bool > {
-
-  /// test operator, returns true if it is a root B
-  bool operator() ( const HepMC::GenParticle * part ) const {
-
-    // Do not consider documentation and special particles
-    if ( part -> status() == LHCb::HepMCEvent::DocumentationParticle ) 
-      return false ;
-    
-    // Check if particle has a b quark
-    LHCb::ParticleID thePid( part -> pdg_id() ) ;
-    if ( ! thePid.hasBottom() ) return false ;
-
-    // Check if particle has a mother
-    if ( 0 == part -> production_vertex() ) return true ;
-
-    // Check all parents of the B 
-    HepMC::GenVertex::particles_in_const_iterator parent ;
-    const HepMC::GenVertex * thePV = part -> production_vertex() ;
-    for ( parent = thePV -> particles_in_const_begin() ;
-          parent != thePV -> particles_in_const_end() ; ++parent ) {
-      LHCb::ParticleID parentID( (*parent) -> pdg_id() ) ;
-      if ( parentID.hasBottom() && (thePid.abspid()==5 || parentID.abspid()!=5)) return false ;
-    }
-
-    // If no parent is a B, then it is a root B
-    return true ;
-  }
-};
-
-//=============================================================================
-// Function to test if a HepMC::GenParticle is a D hadron at root of decay
-//=============================================================================
-struct isRootD : std::unary_function< const HepMC::GenParticle * , bool > {
-
-  /// test operator, returns true if it is a root D
-  bool operator() ( const HepMC::GenParticle * part ) const {
-
-    // Do not consider documentation and special particles
-    if ( part -> status() == LHCb::HepMCEvent::DocumentationParticle ) 
-      return false ;
-
-    // Check if particle has a c quark
-    LHCb::ParticleID thePid( part -> pdg_id() ) ;
-    if ( ! thePid.hasCharm() ) return false ;
-    if ( thePid.hasBottom() ) return false ;
-
-    // Check if particle has a mother
-    if ( 0 == part -> production_vertex() ) return true ;
-
-    // Check all parents of the D
-    HepMC::GenVertex::particles_in_const_iterator parent ;
-    const HepMC::GenVertex * thePV = part -> production_vertex() ;
-    for ( parent = thePV -> particles_in_const_begin() ;
-          parent != thePV -> particles_in_const_end() ; ++parent ) {
-      LHCb::ParticleID parentID( (*parent) -> pdg_id() ) ;
-      if ( parentID.hasCharm()  && (parentID.abspid()!=4 || thePid.abspid()==4)) return false ;
-    }
-
-    // If no parent is a D, then it is a root D
-    return true ;
-  }
-};
-
-//=============================================================================
-// Function to test if a HepMC::GenParticle is a B hadron at end of decay tree
-//=============================================================================
-struct isEndB : std::unary_function< const HepMC::GenParticle * , bool > {
-
-  /// Test operator. Returns true if particle is the last B
-  bool operator() ( const HepMC::GenParticle * part ) const {
-
-    // Do not look at special particles
-    if ( part -> status() == LHCb::HepMCEvent::DocumentationParticle ) 
-      return false ;
-
-    // Test if particle has a b quark
-    LHCb::ParticleID thePid( part -> pdg_id() ) ;
-    if ( ! thePid.hasBottom() ) return false ;
-
-    // test oscillation
-    if ( ! HepMCUtils::IsBAtProduction( part ) ) return false ;
-
-    // Test if the B has daughters (here we are sure it has not oscillated)
-    if ( 0 == part -> end_vertex() ) return true ;
-    
-    // Loop over daughters to check if they are B hadrons
-    HepMC::GenVertex::particles_out_const_iterator children ;
-    const HepMC::GenVertex * theEV = part -> end_vertex() ;
-    for ( children = theEV -> particles_out_const_begin() ;
-          children != theEV -> particles_out_const_end() ; ++children ) {
-      LHCb::ParticleID childID( (*children) -> pdg_id() ) ;
-      if ( childID.hasBottom() ) {
-        if ( (*children) -> pdg_id() == - part -> pdg_id() ) return true ;
-        return false ;
-      }
-    }
-
-    // If not, then it is a end B
-    return true ;
-  }
-};
-
-//=============================================================================
-// Function to test if a HepMC::GenParticle is a D hadron at end of decay tree
-//=============================================================================
-struct isEndD : std::unary_function< const HepMC::GenParticle * , bool > {
-
-  /// Test operator. Returns true if it is the last D
-  bool operator() ( const HepMC::GenParticle * part ) const {
-
-    // Do not look at special particles
-    if ( part -> status() == LHCb::HepMCEvent::DocumentationParticle ) 
-      return false ;
-
-    // Check if it has a c quark
-    LHCb::ParticleID thePid( part -> pdg_id() ) ;
-    if ( ! thePid.hasCharm() ) return false ;
-
-    // Check if it has daughters
-    if ( 0 == part -> end_vertex() ) return true ;
-
-    // Loop over the daughters to find a D hadron
-    HepMC::GenVertex::particles_out_const_iterator children ;
-    const HepMC::GenVertex * theEV = part -> end_vertex() ;
-    for ( children = theEV -> particles_out_const_begin() ;
-          children != theEV -> particles_out_const_end() ; ++children ) {
-      LHCb::ParticleID childID( (*children) -> pdg_id() ) ;
-      if ( childID.hasCharm() ) return false ;
-    }
-
-    // If not, then it is a End D
-    return true ;
-  }
-};
-
-//-----------------------------------------------------------------------------
-// Implementation file for namespace : GenCounters
-//
-// 2006-02-06 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// Setup names of B hadron counters
-//=============================================================================
-void GenCounters::setupBHadronCountersNames( BHadronCNames & BC , 
-                                             BHadronCNames & antiBC ) {
-    BC[ Bd ] = "B0" ;
-    BC[ Bu ] = "B+" ;
-    BC[ Bs ] = "Bs0" ;
-    BC[ Bc ] = "Bc+" ;
-    BC[ bBaryon ] = "b-Baryon" ;
-
-    antiBC[ Bd ] = "anti-B0" ;
-    antiBC[ Bu ] = "B-" ;
-    antiBC[ Bs ] = "anti-Bs0" ;
-    antiBC[ Bc ] = "Bc-" ;
-    antiBC[ bBaryon ] = "anti-b-Baryon" ;
-}
-
-//=============================================================================
-// Setup names of D hadron counters
-//=============================================================================
-void GenCounters::setupDHadronCountersNames( DHadronCNames & DC , 
-                                             DHadronCNames & antiDC ) {
-    DC[ D0 ] = "D0" ;
-    DC[ Dch ] = "D+" ;
-    DC[ Ds ] = "Ds+" ;
-    DC[ cBaryon ] = "c-Baryon" ;
-
-    antiDC[ D0 ] = "anti-D0" ;
-    antiDC[ Dch ] = "D-" ;
-    antiDC[ Ds ] = "Ds-" ;
-    antiDC[ cBaryon ] = "anti-c-Baryon" ;
-}
-
-//=============================================================================
-// Setup names of B excited states
-//=============================================================================
-void GenCounters::setupExcitedCountersNames( ExcitedCNames & B , 
-                                             const std::string & root ) {
-  B[ _0star ] = root + "(L=0,J=0)";
-    B[ _1star ] = root + "* (L=0, J=1)" ;
-    B[ _2star ] = root + "** (L=1, J=0,1,2)" ;
-}
-
-//=============================================================================
-// Count excited states counters
-//=============================================================================
-void GenCounters::updateExcitedStatesCounters
-( const HepMC::GenEvent * theEvent , ExcitedCounter & thebExcitedC ,
-  ExcitedCounter & thecExcitedC ) {
-  // Signal Vertex
-  HepMC::GenVertex * signalV = theEvent -> signal_process_vertex() ;
-
-  // Count B :
-  std::vector< HepMC::GenParticle * > rootB ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( rootB ) , isRootB() ) ;
-
-  std::vector< HepMC::GenParticle * >::const_iterator iter ;
-
-  for ( iter = rootB.begin() ; iter != rootB.end() ; ++iter ) {
-    if ( 0 != signalV ) {
-      if ( ! HepMCUtils::commonTrees( signalV ,
-                                      (*iter) -> end_vertex() ) ) 
-        continue ;
-    }
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-
-    if ( thePid.isMeson() ) {
-      if ( 0 == thePid.lSpin() ) {
-        if ( 1 == thePid.jSpin() ) ++thebExcitedC[ _0star ] ;
-        else ++thebExcitedC[ _1star ] ;
-      } else ++thebExcitedC[ _2star ] ;
-    }
-  }
-
-  // Count D :
-  std::vector< HepMC::GenParticle * > rootD ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( rootD ) , isRootD() ) ;
-
-  for ( iter = rootD.begin() ; iter != rootD.end() ; ++iter ) {
-    if ( 0 != signalV ) {
-      if ( ! HepMCUtils::commonTrees( signalV , 
-                                      (*iter) -> end_vertex() ) ) 
-        continue ;
-    }
-    
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-    if ( thePid.isMeson() ) {
-      if ( 0 == thePid.lSpin() ) {
-        if ( 1 == thePid.jSpin() ) ++thecExcitedC[ _0star ] ;
-        else ++thecExcitedC[ _1star ] ;
-        } else ++thecExcitedC[ _2star ] ;
-    }
-  }       
-}
-
-//=============================================================================
-// Update the counters of number of different hadrons in selected events
-//=============================================================================
-void GenCounters::updateHadronCounters( const HepMC::GenEvent * theEvent ,
-                                        BHadronCounter & thebHadC , 
-                                        BHadronCounter & theantibHadC ,
-                                        DHadronCounter & thecHadC ,
-                                        DHadronCounter & theanticHadC ,
-                                        unsigned int & thebbCounter ,
-                                        unsigned int & theccCounter ) {
-  // Signal vertex
-  HepMC::GenVertex * signalV = theEvent -> signal_process_vertex() ;
-
-  // Count B:
-  std::vector< HepMC::GenParticle * > endB ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( endB ) , isEndB() ) ;
-  std::vector< HepMC::GenParticle * >::const_iterator iter ;
-  
-  for ( iter = endB.begin() ; iter != endB.end() ; ++iter ) {
-    if ( 0 != signalV ) {
-      if ( HepMCUtils::commonTrees( signalV , 
-                                    (*iter) -> end_vertex() ) )
-        continue ;
-    }
-    
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-    
-    if ( thePid.isMeson() ) {
-      if ( thePid.pid() > 0 ) {
-        if ( thePid.hasUp() ) ++thebHadC[ Bu ] ;
-        else if ( thePid.hasDown() ) ++thebHadC[ Bd ] ;
-        else if ( thePid.hasStrange() ) ++thebHadC[ Bs ] ;
-        else if ( thePid.hasCharm() ) ++thebHadC[ Bc ] ;
-        else ++thebbCounter ;
-      } else {
-        if ( thePid.hasUp() ) ++theantibHadC[ Bu ] ;
-        else if ( thePid.hasDown() ) ++theantibHadC[ Bd ] ;
-        else if ( thePid.hasStrange() ) ++theantibHadC[ Bs ] ;
-        else if ( thePid.hasCharm() ) ++theantibHadC[ Bc ] ;
-        else ++thebbCounter ;
-      }
-    } else if ( thePid.isBaryon() ) {
-      if ( thePid.pid() < 0 ) ++thebHadC[ bBaryon ] ;
-      else ++theantibHadC[ bBaryon ] ;
-    }
-  }
-  
-  std::vector< HepMC::GenParticle * > endD ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( endD ) , isEndD() ) ;
-  
-  for ( iter = endD.begin() ; iter != endD.end() ; ++iter ) {
-    if ( 0 != signalV ) {
-      if ( HepMCUtils::commonTrees( signalV ,
-                                    (*iter) -> end_vertex() ) ) 
-        continue ;
-    }
-    
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-    
-    if ( thePid.isMeson() ) {
-      if ( thePid.pid() > 0 ) {
-        if ( thePid.hasUp() ) ++thecHadC[ D0 ] ;
-        else if ( thePid.hasDown() ) ++thecHadC[ Dch ] ;
-        else if ( thePid.hasStrange() ) ++thecHadC[ Ds ] ;
-        else ++theccCounter ;
-      } else {
-        if ( thePid.hasUp() ) ++theanticHadC[ D0 ] ;
-        else if ( thePid.hasDown() ) ++theanticHadC[ Dch ] ;
-        else if ( thePid.hasStrange() ) ++theanticHadC[ Ds ] ;
-        else ++theccCounter ;
-      }
-    } else if ( thePid.isBaryon() ) {
-      if ( thePid.pid() > 0 ) ++thecHadC[ cBaryon ] ;
-      else ++theanticHadC[ cBaryon ] ;
-    }
-  } 
-}
-
-
-//=============================================================================                    
-// Update the genFRS in selected events                                                            
-//=============================================================================                    
-void GenCounters::updateHadronFSR( const HepMC::GenEvent * theEvent ,
-                                   LHCb::GenFSR* genFSR,
-                                   const std::string option)
-{  
-  // Signal Vertex                                                                        
-  HepMC::GenVertex * signalV = theEvent -> signal_process_vertex() ;
-  int key = 0;
-  
-  // Count B :                                                                                    
-  std::vector< HepMC::GenParticle * > rootB ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( rootB ) , isRootB() ) ;
-
-  std::vector< HepMC::GenParticle * >::const_iterator iter ;
-
-  for ( iter = rootB.begin() ; iter != rootB.end() ; ++iter )
-  {
-    if ( 0 != signalV )
-    {  
-      if ( ! HepMCUtils::commonTrees( signalV ,
-                                      (*iter) -> end_vertex() ) )
-        continue ; 
-    }    
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-
-    if (thePid.isMeson())
-    {
-      if (0 == thePid.lSpin())
-      {
-        if (1 == thePid.jSpin())
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("B"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bstar"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      }
-      else
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("B2star"+option);
-        genFSR->incrementGenCounter(key, 1);                                                                                        
-      } 
-    } 
-  }
-
-  // Count D :                                                                                     
-  std::vector< HepMC::GenParticle * > rootD ;  
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( rootD ) , isRootD() ) ;
-
-  for ( iter = rootD.begin() ; iter != rootD.end() ; ++iter )
-  {
-    if ( 0 != signalV )
-    {
-      if ( ! HepMCUtils::commonTrees( signalV ,
-                                      (*iter) -> end_vertex() ) )
-        continue ; 
-    }
-
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() );
-
-    if (thePid.isMeson())
-    {
-      if (0 == thePid.lSpin())
-      {
-        if (1 == thePid.jSpin())
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("D"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Dstar"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      }
-      else
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("D2star"+option);
-        genFSR->incrementGenCounter(key, 1); 
-      } 
-    } 
-  }
-
-  // Count B:                                                                                     
-  std::vector< HepMC::GenParticle * > endB ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( endB ) , isEndB() ) ;
-
-  for ( iter = endB.begin() ; iter != endB.end() ; ++iter )
-  {
-    if ( 0 != signalV )
-    {
-      if ( HepMCUtils::commonTrees( signalV ,
-                                    (*iter) -> end_vertex() ) )
-        continue ;      
-    }
-
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-
-    if ( thePid.isMeson() )                                                                                                               
-    {                                                                                                                                  
-      if ( thePid.pid() > 0 )
-      {                                                                                                                              
-        if ( thePid.hasUp() )                                                                                                         
-        {                                                              
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bplus"+option);
-          genFSR->incrementGenCounter(key, 1);                                                                                       
-        }                                                                                                                          
-        else if ( thePid.hasDown() )                                                                                                  
-        {                                                                 
-          key = LHCb::GenCountersFSR::CounterKeyToType("B0"+option);
-          genFSR->incrementGenCounter(key, 1);                                                                                       
-        }                                                                                                                          
-        else if ( thePid.hasStrange() )                                                                                               
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bs0"+option); 
-          genFSR->incrementGenCounter(key, 1);
-        }
-        else if ( thePid.hasCharm() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bcplus"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("bb"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      }
-      else
-      {
-        if ( thePid.hasUp() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bminus"+option);
-          genFSR->incrementGenCounter(key, 1);
-        }
-        else if ( thePid.hasDown() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("antiB0"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasStrange() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("antiBs0"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasCharm() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Bcminus"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("bb"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      } 
-    }
-    else if ( thePid.isBaryon() )
-    {
-      if ( thePid.pid() < 0 )
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("bBaryon"+option);
-        genFSR->incrementGenCounter(key, 1); 
-      }
-      else
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("antibBaryon"+option);
-        genFSR->incrementGenCounter(key, 1); 
-      } 
-    } 
-  }
-
-  // Count D:                                                                                   
-  std::vector< HepMC::GenParticle * > endD ;
-  HepMC::copy_if( theEvent -> particles_begin() , theEvent -> particles_end() ,
-                  std::back_inserter( endD ) , isEndD() ) ;
-
-  for ( iter = endD.begin() ; iter != endD.end() ; ++iter )
-  {
-    if ( 0 != signalV )
-    {
-      if ( HepMCUtils::commonTrees( signalV ,
-                                    (*iter) -> end_vertex() ) )
-        continue ;      
-    }
-
-    LHCb::ParticleID thePid( (*iter) -> pdg_id() ) ;
-
-    if ( thePid.isMeson() )
-    {
-      if ( thePid.pid() > 0 )
-      {
-        if ( thePid.hasUp() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("D0"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasDown() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Dplus"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasStrange() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Dsplus"+option);
-          genFSR->incrementGenCounter(key, 1);
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("cc"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      }
-      else
-      {
-        if ( thePid.hasUp() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("antiD0"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasDown() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Dminus"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else if ( thePid.hasStrange() )
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("Dsminus"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        }
-        else
-        {
-          key = LHCb::GenCountersFSR::CounterKeyToType("cc"+option);
-          genFSR->incrementGenCounter(key, 1); 
-        } 
-      } 
-    }
-    else if ( thePid.isBaryon() )
-    {
-      if ( thePid.pid() > 0 )
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("cBaryon"+option);
-        genFSR->incrementGenCounter(key, 1); 
-      }
-      else
-      {
-        key = LHCb::GenCountersFSR::CounterKeyToType("anticBaryon"+option);
-        genFSR->incrementGenCounter(key, 1); 
-      } 
-    } 
-  } 
-}
diff --git a/Gen/Generators/src/Lib/LBPHOTOS.F b/Gen/Generators/src/Lib/LBPHOTOS.F
deleted file mode 100644
index 0e441e60b72abaea0b4f981e2f39b91ee3a1500f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LBPHOTOS.F
+++ /dev/null
@@ -1,19 +0,0 @@
-C $Id: $
-      SUBROUTINE SetPhotosOutputUnit( OUTPUTUNIT ) 
-C-----------------------------------------------------------------------
-C  Purpose   : Change the default output unit of photos
-C  Arguments : 
-C
-C  Author    : Patrick Robbe
-C  Created   : 2013-05-31
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C- Include Files
-C- Local Variables
-      INTEGER PHLUN
-      COMMON/PHOLUN/PHLUN
-      INTEGER OUTPUTUNIT
-C-----------------------------------------------------------------------
-      PHLUN = OUTPUTUNIT 
-  999 RETURN
-      END
diff --git a/Gen/Generators/src/Lib/LBTAULA.F b/Gen/Generators/src/Lib/LBTAULA.F
deleted file mode 100644
index b1309361eedc2b632c8cfcb9f3d328db182526a9..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LBTAULA.F
+++ /dev/null
@@ -1,19 +0,0 @@
-C $Id: $
-      SUBROUTINE SetTaulaOutputUnit( OUTPUTUNIT ) 
-C-----------------------------------------------------------------------
-C  Purpose   : Change the default output unit of taula
-C  Arguments : 
-C
-C  Author    : Patrick Robbe
-C  Created   : 2013-05-31
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C- Include Files
-C- Local Variables
-      INTEGER OUTPUTUNIT
-      COMMON / INOUT / INUT,IOUT
-      INTEGER INUT, IOUT
-C-----------------------------------------------------------------------
-      IOUT = OUTPUTUNIT 
-  999 RETURN
-      END
diff --git a/Gen/Generators/src/Lib/LHAPDFCommonBlocks.cpp b/Gen/Generators/src/Lib/LHAPDFCommonBlocks.cpp
deleted file mode 100755
index 041c71987f1a27046a3c9b08e7485730e826467f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LHAPDFCommonBlocks.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// $Id: LHAPDFCommonBlocks.cpp,v 1.4 2009-10-22 16:43:05 robbep Exp $
-// access LHAPDF common LHASILENT
-#include "Generators/LHAPDFCommonBlocks.h"
-#include <cstring>
-
-extern "C" {
-#ifdef WIN32
-  void __stdcall GGETLHAPARM( int * , char * , int ) ;
-  void __stdcall GSETLHAPARM( int * , char * , int ) ;
-  void __stdcall GGETLHAVALUE( int * , double * ) ;
-  void __stdcall GSETLHAVALUE( int * , double * ) ;
-#else 
-  void ggetlhaparm_( int * , char * , int ) ;
-  void gsetlhaparm_( int * , char * , int ) ;
-  void ggetlhavalue_( int * , double * ) ;
-  void gsetlhavalue_( int * , double * ) ;
-#endif
-}
-
-// Constructor
-Lhacontrol::Lhacontrol(): m_dummystr( "" ) ,  m_dummy( -999. ) { }
-
-// Destructor
-Lhacontrol::~Lhacontrol() { }
-
-// access lhaparm in common
-void Lhacontrol::setlhaparm( int n , const std::string & value ) {
-  char * arg = new char[ 20 ] ; 
-  strncpy( arg , value.c_str() , value.size() ) ;
-  if ( n < 1 || n > lenlhaparm() ) { 
-    delete [] arg ;
-    return ; 
-  }
-#ifdef WIN32
-  GSETLHAPARM( & n , arg , strlen( arg ) ) ;
-#else
-  gsetlhaparm_( & n , arg , strlen( arg ) ) ;
-#endif
-  delete [] arg ;
-}
-
-void Lhacontrol::getlhaparm( int n , std::string & value ) {
-  if ( n < 1 || n > lenlhaparm() ) {
-    value = m_dummystr ;
-    return ;
-  }
-  char * arg = new char[ 20 ] ;
-#ifdef WIN32
-  GGETLHAPARM( &n , arg , strlen( arg ) ) ;
-#else
-  ggetlhaparm_( &n , arg , strlen( arg ) ) ;
-#endif
-  value = arg ;
-  delete [] arg ;
-}
-
-// access lhavalue in common
-void Lhacontrol::setlhavalue( int n , double value ) {
-  if ( n < 1 || n > lenlhaparm() ) return ;
-#ifdef WIN32
-  GSETLHAVALUE( &n , &value ) ;
-#else
-  gsetlhavalue_( &n , &value ) ;
-#endif
-}
-
-void Lhacontrol::getlhavalue( int n , double & value ) {
-  if ( n < 1 || n > lenlhaparm() ) {
-    value = m_dummy ;
-    return ;
-  }  
-#ifdef WIN32
-  GGETLHAVALUE( &n , &value ) ;
-#else
-  ggetlhavalue_( &n , &value ) ;
-#endif
-}
-
diff --git a/Gen/Generators/src/Lib/LHAPDFUtils.F b/Gen/Generators/src/Lib/LHAPDFUtils.F
deleted file mode 100755
index 7244f4803e1d21451c230213b015d4116549fa3a..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LHAPDFUtils.F
+++ /dev/null
@@ -1,54 +0,0 @@
-C $Id: LHAPDFUtils.F,v 1.6 2008-05-23 11:56:18 robbep Exp $
-      SUBROUTINE GGETLHAPARM( INDEX , VALUE ) 
-      IMPLICIT NONE 
-      
-      INTEGER INDEX
-      CHARACTER*20 VALUE
-
-      CHARACTER*20 LHAPARM(20)
-      DOUBLE PRECISION LHAVALUE(20)
-      COMMON/LHACONTROL/LHAPARM,LHAVALUE
-
-      VALUE = LHAPARM( INDEX ) 
-      END
-
-
-      SUBROUTINE GSETLHAPARM( INDEX , VALUE ) 
-      IMPLICIT NONE 
-      
-      INTEGER INDEX
-      CHARACTER*(*) VALUE
-
-      CHARACTER*20 LHAPARM(20)
-      DOUBLE PRECISION LHAVALUE(20)
-      COMMON/LHACONTROL/LHAPARM,LHAVALUE
-
-      LHAPARM( INDEX ) = VALUE(1:LEN(VALUE))
-      END
-
-      SUBROUTINE GGETLHAVALUE( INDEX , VALUE ) 
-      IMPLICIT NONE 
-      
-      INTEGER INDEX
-      DOUBLE PRECISION VALUE
-
-      CHARACTER*20 LHAPARM(20)
-      DOUBLE PRECISION LHAVALUE(20)
-      COMMON/LHACONTROL/LHAPARM,LHAVALUE
-
-      VALUE = LHAVALUE( INDEX ) 
-      END
-
-
-      SUBROUTINE GSETLHAVALUE( INDEX , VALUE ) 
-      IMPLICIT NONE 
-      
-      INTEGER INDEX
-      DOUBLE PRECISION VALUE
-
-      CHARACTER*20 LHAPARM(20)
-      DOUBLE PRECISION LHAVALUE(20)
-      COMMON/LHACONTROL/LHAPARM,LHAVALUE
-
-      LHAVALUE( INDEX ) = VALUE
-      END
diff --git a/Gen/Generators/src/Lib/LbPhotos.cpp b/Gen/Generators/src/Lib/LbPhotos.cpp
deleted file mode 100644
index dd431b06454965e785a2866859d5bf77593af966..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LbPhotos.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Include files
-// local
-#include "Generators/LbPhotos.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : LbPhotos
-//
-// 2013-05-31 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-extern "C" {
-#ifdef WIN32
-  void __stdcall SETPHOTOSOUTPUTUNIT( int * ) ;
-#else
-  void setphotosoutputunit_( int * ) ;
-#endif
-}
-
-void LbPhotos::setOutputUnit( int outputUnit ) {
-#ifdef WIN32
-  SETPHOTOSOUTPUTUNIT( &outputUnit ) ;
-#else
-  setphotosoutputunit_( &outputUnit ) ;
-#endif
-}
diff --git a/Gen/Generators/src/Lib/LbTaula.cpp b/Gen/Generators/src/Lib/LbTaula.cpp
deleted file mode 100644
index 2e41207d486b07cdbee2febab83e4bd9f3452cac..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LbTaula.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Include files
-// local
-#include "Generators/LbTaula.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : LbTaula
-//
-// 2013-05-31 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-extern "C" {
-#ifdef WIN32
-  void __stdcall SETTAULAOUTPUTUNIT( int * ) ;
-#else
-  void settaulaoutputunit_( int * ) ;
-#endif
-}
-
-void LbTaula::setOutputUnit( int outputUnit ) {
-#ifdef WIN32
-  SETTAULAOUTPUTUNIT( &outputUnit ) ;
-#else
-  settaulaoutputunit_( &outputUnit ) ;
-#endif
-}
diff --git a/Gen/Generators/src/Lib/LhaPdf.cpp b/Gen/Generators/src/Lib/LhaPdf.cpp
deleted file mode 100755
index ceb6d125a41ebe93a0728a9068f2ebcc75b1f17f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/LhaPdf.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id: LhaPdf.cpp,v 1.1 2005-12-07 23:02:09 robbep Exp $
-// Include files
-
-// local
-#include "Generators/LhaPdf.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : LhaPdf
-//
-// 2005-12-07 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-Lhacontrol LhaPdf::s_lhacontrol ;
diff --git a/Gen/Generators/src/Lib/RandomForGenerator.cpp b/Gen/Generators/src/Lib/RandomForGenerator.cpp
deleted file mode 100755
index f04762b5bfca419df3cc00e706973ad0261c07b9..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/RandomForGenerator.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id: RandomForGenerator.cpp,v 1.2 2007-10-11 13:23:26 robbep Exp $
-// Include files
-
-// local
-#include "Generators/RandomForGenerator.h"
-
-Rndm::Numbers RandomForGenerator::s_randgaudi ;
-
-Rndm::Numbers & RandomForGenerator::getNumbers() {
-  return s_randgaudi ;
-}
-
-double RandomForGenerator::flat( ) {
-  return s_randgaudi() ;
-}
-
diff --git a/Gen/Generators/src/Lib/Signal.cpp b/Gen/Generators/src/Lib/Signal.cpp
deleted file mode 100755
index 789278684416a51699ed65fa38ac7fa3f8d0708f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/Signal.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-// Include files
-
-// local
-#include "Generators/Signal.h"
-
-// from Gaudi
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-#include "GaudiKernel/IRndmGenSvc.h"
-
-// from Generators
-#include "MCInterfaces/IDecayTool.h"
-#include "Generators/GenCounters.h"
-#include "GenEvent/HepMCUtils.h"
-
-// from Event
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// Function to test if a HepMC::GenParticle is Particle (or antiParticle)
-struct isParticle : std::unary_function< const HepMC::GenParticle * , bool > {
-  bool operator() ( const HepMC::GenParticle * part ) const {
-    return ( part -> pdg_id() > 0 ) ;
-  }
-};
-
-// Functions to test if a HepMC::GenParticle goes forward
-struct isForwardParticle :
-  std::unary_function< const HepMC::GenParticle * , bool > {
-  bool operator() ( const HepMC::GenParticle * part ) const {
-    return ( ( part -> pdg_id() > 0 ) && ( part -> momentum().pz() > 0 ) ) ;
-  }
-};
-
-struct isForwardAntiParticle :
-  std::unary_function< const HepMC::GenParticle * , bool > {
-  bool operator() ( const HepMC::GenParticle * part ) const {
-    return ( ( part -> pdg_id() < 0 ) && ( part -> momentum().pz() > 0 ) ) ;
-  }
-};
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : Signal
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-Signal::Signal( const std::string& type,
-                const std::string& name,
-                const IInterface* parent )
-  : ExternalGenerator( type, name , parent ) ,
-    m_nEventsBeforeCut   ( 0 ) , m_nEventsAfterCut        ( 0 ) ,
-    m_nParticlesBeforeCut( 0 ) , m_nAntiParticlesBeforeCut( 0 ) ,
-    m_nParticlesAfterCut ( 0 ) , m_nAntiParticlesAfterCut ( 0 ) ,
-    m_nInvertedEvents ( 0 ) ,
-    m_signalQuark     ( LHCb::ParticleID::down ) ,
-    m_signalPID       ( 0 ) ,
-    m_bbCounter       ( 0 ) ,
-    m_ccCounter       ( 0 ) ,
-    m_nSig            ( 0 ) ,
-    m_nSigBar         ( 0 ) ,
-    m_sigName        ( "" ) ,
-    m_sigBarName     ( "" ) ,
-    m_cpMixture       ( true ) ,
-    m_signalBr ( 0.0 ) {
-    declareProperty( "SignalPIDList" , m_pidVector ) ;
-    declareProperty( "Clean" , m_cleanEvents = false ) ;
-    declareProperty( "RevertWhenBackward" , m_revertWhenBackward = true ) ;
-
-    m_bHadC.assign( 0 ) ;  m_antibHadC.assign( 0 ) ;
-    m_cHadC.assign( 0 ) ;  m_anticHadC.assign( 0 ) ;
-
-    m_bExcitedC.assign( 0 ) ;
-    m_cExcitedC.assign( 0 ) ;
-
-    GenCounters::setupBHadronCountersNames( m_bHadCNames , m_antibHadCNames ) ;
-    GenCounters::setupDHadronCountersNames( m_cHadCNames , m_anticHadCNames ) ;
-
-    GenCounters::setupExcitedCountersNames( m_bExcitedCNames , "B" ) ;
-    GenCounters::setupExcitedCountersNames( m_cExcitedCNames , "D" ) ;
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-Signal::~Signal( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode Signal::initialize( ) {
-  StatusCode sc = ExternalGenerator::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  if ( m_pidVector.empty() )
-    return Error( "SignalPIDList property is not set" ) ;
-
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  sc = m_flatGenerator.initialize( randSvc , Rndm::Flat( 0., 1. ) ) ;
-  if ( ! sc.isSuccess() )
-    return Error( "Could not initialize flat random number generator" ) ;
-
-  release( randSvc ) ;
-
-  // Transform vector into set
-  for ( std::vector<int>::iterator it = m_pidVector.begin() ;
-        it != m_pidVector.end() ; ++it ) m_pids.insert( *it ) ;
-
-  LHCb::IParticlePropertySvc * ppSvc =
-    svc< LHCb::IParticlePropertySvc >( "LHCb::ParticlePropertySvc" ) ;
-
-  info() << "Generating Signal events of " ;
-  PIDs::const_iterator it2 ;
-  for ( it2 = m_pids.begin() ; it2 != m_pids.end() ; ++it2 ) {
-    const LHCb::ParticleProperty * prop = ppSvc -> find( LHCb::ParticleID( *it2 ) ) ;
-    info() << prop -> particle() << " " ;
-
-    LHCb::ParticleID pid( prop -> pdgID() ) ;
-
-    m_signalPID  = pid.abspid() ;
-    if ( pid.hasCharm() ) m_signalQuark = LHCb::ParticleID::charm ;
-    else if ( pid.hasBottom()    ) m_signalQuark = LHCb::ParticleID::bottom ;
-
-    if ( pid.pid() > 0 ) { m_sigName = prop -> particle() ; }
-    else { m_sigBarName = prop -> particle() ; }
-
-  }
-
-  m_cpMixture = false ;
-
-  if ( 2 == m_pids.size() ) {
-    if ( *m_pids.begin() == - *(--m_pids.end()) ) m_cpMixture = true ;
-    else return Error( "Bad configuration in PID list" ) ;
-  } else if ( m_pids.size() > 2 ) return Error( "Too many PIDs in list" ) ;
-
-  if ( m_decayTool ) m_decayTool -> setSignal( *m_pids.begin() ) ;
-
-  if ( m_decayTool ) m_signalBr = m_decayTool -> getSignalBr( ) ;
-  else m_signalBr = 0. ;
-
-  info() << endmsg ;
-  release( ppSvc ) ;
-
-  if ( 0. == m_signalBr )
-    warning()
-      << "The signal decay mode is not defined in the main DECAY.DEC table"
-      << std::endl << "Please add it there !" << endmsg ;
-  else
-    info() << "The signal decay mode has visible branching fractions of :"
-           << m_signalBr << endmsg ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Print the counters
-//=============================================================================
-void Signal::printCounters( ) const {
-  using namespace GenCounters ;
-  printEfficiency( m_xmlLogTool , "generator level cut" , m_nEventsAfterCut ,
-                   m_nEventsBeforeCut ) ;
-  printCounter( m_xmlLogTool , "z-inverted events" , m_nInvertedEvents ) ;
-
-  printEfficiency( m_xmlLogTool , "generator particle level cut" ,
-                   m_nParticlesAfterCut ,  m_nParticlesBeforeCut ) ;
-  printEfficiency( m_xmlLogTool , "generator anti-particle level cut" ,
-                   m_nAntiParticlesAfterCut , m_nAntiParticlesBeforeCut ) ;
-
-  if ( "" != m_sigName ) printFraction( m_xmlLogTool , "signal " + m_sigName +
-                                        " in sample" , m_nSig , m_nSig +
-                                        m_nSigBar ) ;
-  if ( "" != m_sigBarName ) printFraction( m_xmlLogTool , "signal " + m_sigBarName +
-                                           " in sample" , m_nSigBar , m_nSig +
-                                           m_nSigBar ) ;
-
-  printArray( m_xmlLogTool , m_bHadC , m_bHadCNames , "accepted" ) ;
-  printArray( m_xmlLogTool , m_antibHadC , m_antibHadCNames , "accepted" ) ;
-  printCounter( m_xmlLogTool , "accepted (bb)" , m_bbCounter ) ;
-
-  printArray( m_xmlLogTool , m_cHadC , m_cHadCNames , "accepted" ) ;
-  printArray( m_xmlLogTool , m_anticHadC , m_anticHadCNames , "accepted" ) ;
-  printCounter( m_xmlLogTool , "accepted (cc)" , m_ccCounter ) ;
-
-  printArray( m_xmlLogTool , m_bExcitedC , m_bExcitedCNames , "accepted" ) ;
-  printArray( m_xmlLogTool , m_cExcitedC , m_cExcitedCNames , "accepted" ) ;
-}
-
-//=============================================================================
-// Isolate signal to produce "clean" events
-//=============================================================================
-StatusCode Signal::isolateSignal( const HepMC::GenParticle * theSignal )
-  const {
-
-  StatusCode sc = StatusCode::SUCCESS ;
-  // Create a new event to contain isolated signal decay tree
-  LHCb::HepMCEvent * mcevt = new LHCb::HepMCEvent( ) ;
-  mcevt -> setGeneratorName( m_hepMCName + "_clean" ) ;
-
-  if ( 0 == theSignal -> production_vertex() )
-    return Error( "Signal particle has no production vertex." ) ;
-
-  // create a new vertex and a new HepMC Particle for the root particle
-  // (a copy of which will be associated to the new HepMC event)
-
-  HepMC::GenVertex * newVertex =
-    new HepMC::GenVertex( theSignal -> production_vertex() -> position() ) ;
-
-  HepMC::GenEvent * hepMCevt = mcevt -> pGenEvt() ;
-
-  hepMCevt -> add_vertex( newVertex ) ;
-
-  HepMC::GenParticle * theNewParticle =
-    new HepMC::GenParticle( theSignal -> momentum() , theSignal -> pdg_id() ,
-                            theSignal -> status() ) ;
-
-  newVertex -> add_particle_out( theNewParticle ) ;
-
-  // Associate the new particle to the HepMC event
-  // and copy all tree to the new HepMC event
-  sc = fillHepMCEvent( theNewParticle , theSignal ) ;
-  hepMCevt -> set_signal_process_vertex( theNewParticle -> production_vertex() ) ;
-
-  if ( ! sc.isSuccess( ) )
-    return Error( "Could not fill HepMC event for signal tree" , sc ) ;
-
-  // Check if container already exists
-  if ( exist< LHCb::HepMCEvents >( LHCb::HepMCEventLocation::Signal ) )
-    return Error( "SignalDecayTree container already exists !" ) ;
-
-  LHCb::HepMCEvents * hepVect = new LHCb::HepMCEvents ;
-  hepVect -> insert( mcevt ) ;
-
-  // Register new location and store HepMC event
-  put( hepVect , LHCb::HepMCEventLocation::Signal ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Fill HepMC event from a HepMC tree
-//=============================================================================
-StatusCode Signal::fillHepMCEvent( HepMC::GenParticle * theNewParticle ,
-                                   const HepMC::GenParticle * theOldParticle )
-  const {
-  StatusCode sc = StatusCode::SUCCESS ;
-  //
-  // Copy theOldParticle to theNewParticle in theEvent
-  // theNewParticle already exist and is created outside this function
-  HepMC::GenVertex * oVertex = theOldParticle -> end_vertex() ;
-  if ( 0 != oVertex ) {
-    // Create decay vertex and associate it to theNewParticle
-    HepMC::GenVertex * newVertex =
-      new HepMC::GenVertex( oVertex -> position() ) ;
-    newVertex -> add_particle_in( theNewParticle ) ;
-    theNewParticle -> parent_event() -> add_vertex( newVertex ) ;
-
-    // loop over child particle of this vertex after sorting them
-    std::list< const HepMC::GenParticle * > outParticles ;
-    for ( HepMC::GenVertex::particles_out_const_iterator itP =
-            oVertex -> particles_out_const_begin() ;
-          itP != oVertex -> particles_out_const_end() ; ++itP )
-      outParticles.push_back( (*itP ) ) ;
-
-    outParticles.sort( HepMCUtils::compareHepMCParticles ) ;
-
-    std::list< const HepMC::GenParticle * >::const_iterator child ;
-    for ( child = outParticles.begin( ) ; child != outParticles.end( ) ;
-          ++child ) {
-
-      // Create a new particle for each daughter of theOldParticle
-      HepMC::GenParticle * newPart =
-        new HepMC::GenParticle ( (*child) -> momentum () ,
-                                 (*child) -> pdg_id ()   ,
-                                 (*child) -> status ()   ) ;
-      newVertex -> add_particle_out( newPart ) ;
-
-      const HepMC::GenParticle * theChild = (*child) ;
-      // Recursive call : fill the event with the daughters
-      sc = fillHepMCEvent( newPart , theChild ) ;
-
-      if ( ! sc.isSuccess() ) return sc ;
-    }
-  }
-  return sc ;
-}
-
-//=============================================================================
-// Choose one particle in acceptance
-//=============================================================================
-HepMC::GenParticle * Signal::chooseAndRevert( const ParticleVector &
-                                              theParticleList ,
-                                              bool & isInverted ,
-                                              bool & hasFlipped ,
-					      bool & hasFailed ) {
-  HepMC::GenParticle * theSignal ;
-  isInverted = false ;
-  hasFlipped = false ;
-  hasFailed = false ;
-
-  unsigned int nPart = theParticleList.size() ;
-  if ( nPart > 1 ) {
-    unsigned int iPart =
-      (unsigned int) floor( nPart * m_flatGenerator() ) ;
-    theSignal = theParticleList[ iPart ] ;
-
-    // Now erase daughters of the other particles in particle list
-    for ( unsigned int i = 0 ; i < nPart ; ++i ) {
-      if ( i != iPart )
-        HepMCUtils::RemoveDaughters( theParticleList[ i ] ) ;
-    }
-  } else if ( 1 == nPart ) theSignal = theParticleList.front() ;
-  else return 0 ;
-
-  if ( theSignal -> momentum().pz() < 0 && m_revertWhenBackward ) {
-    revertEvent( theSignal -> parent_event() ) ;
-    isInverted = true ;
-  }
-
-  // now force the particle to decay
-  if ( m_cpMixture )
-	if ( m_decayTool ) m_decayTool -> enableFlip() ;
-  if ( m_decayTool ) {
-    StatusCode sc = m_decayTool -> generateSignalDecay( theSignal , hasFlipped ) ;
-    if ( ! sc.isSuccess() ) hasFailed = true ;
-  }
-
-  return theSignal ;
-}
-
-//=============================================================================
-// Establish correct multiplicity of signal
-//=============================================================================
-bool Signal::ensureMultiplicity( const unsigned int nSignal ) {
-  if ( ! m_cpMixture ) return true ;
-  if ( nSignal > 1 ) return true ;
-  return ( m_flatGenerator() >= ( ( 1. - m_signalBr ) /
-                                  ( 2. - m_signalBr ) ) ) ;
-}
-
-//=============================================================================
-// update counters for efficiency calculations
-//=============================================================================
-void Signal::updateCounters( const ParticleVector & particleList ,
-                             unsigned int & particleCounter ,
-                             unsigned int & antiparticleCounter ,
-                             bool onlyForwardParticles ,
-                             bool isInverted ) const {
-  int nP( 0 ) , nAntiP( 0 ) ;
-  ParticleVector::const_iterator from = particleList.begin() ;
-  ParticleVector::const_iterator to = particleList.end() ;
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int keyP = 0, keyAP = 0;
-
-  if ( onlyForwardParticles ) {
-    // if the particle has been inverted z -> -z, do not count it
-    if ( ! isInverted ) {
-      keyP = LHCb::GenCountersFSR::AfterPCut;
-      keyAP = LHCb::GenCountersFSR::AfterantiPCut;
-
-      nP = std::count_if( from , to , isForwardParticle() ) ;
-      nAntiP = std::count_if( from , to , isForwardAntiParticle() ) ;
-    }
-  } else {
-    keyP = LHCb::GenCountersFSR::BeforePCut;
-    keyAP = LHCb::GenCountersFSR::BeforeantiPCut;
-
-    nP = std::count_if( from , to , isParticle() ) ;
-    nAntiP = particleList.size() - nP ;
-  }
-
-  particleCounter += nP ;
-  antiparticleCounter += nAntiP ;
-
-  if(genFSR) genFSR->incrementGenCounter(keyP, nP);
-  if(genFSR) genFSR->incrementGenCounter(keyAP, nAntiP);
-
-}
-
diff --git a/Gen/Generators/src/Lib/StreamForGenerator.cpp b/Gen/Generators/src/Lib/StreamForGenerator.cpp
deleted file mode 100755
index 612bc1bc702a94bac6b4809fceabd9c49f6396ff..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/StreamForGenerator.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// $Id: StreamForGenerator.cpp,v 1.2 2007-10-11 13:23:27 robbep Exp $
-// Include files
-
-// local
-#include "Generators/StreamForGenerator.h"
-
-MsgStream * StreamForGenerator::s_gaudiStream = 0 ;
-
-MsgStream *& StreamForGenerator::getStream() {
-  return s_gaudiStream ;
-}
diff --git a/Gen/Generators/src/Lib/StringParse.cpp b/Gen/Generators/src/Lib/StringParse.cpp
deleted file mode 100755
index bc8f19008eeaa9d92c0d2a81c3a252315d42a1b8..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/StringParse.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id: StringParse.cpp,v 1.3 2009-10-22 16:43:05 robbep Exp $
-// --------------------------------------------------
-// 
-// File:  GeneratorUtils/StringParse.cxx
-// Description:
-//    This code is used to parse a string .
-//    it breaks it into components which are seperated by spaces 
-//    in the original. The components can be accessed and converted to 
-//    doubles or ints
-// AuthorList:
-//         Ian Hinchliffe April 2000
-#include "Generators/StringParse.h"
-#include <string>
-#include <vector>
-#include <iostream>
-#include <cmath>
-#include <cstdlib>
-
-StringParse::StringParse( const std::string & input ) {
-  m_past_end="?!?";
-  m_lstring=input;
-  m_nword=0;
-  std::string::size_type pos=0;
-  std::string::size_type prev_pos=0;
-  while ( ( pos = input.find_first_of( ' ' , pos ) ) != std::string::npos ) {
-      m_lsubstring.push_back( input.substr( prev_pos , pos-prev_pos ) ) ;
-      prev_pos=++pos;
-    }
-  // special handling for last substring
-  m_lsubstring.push_back( input.substr( prev_pos , pos-prev_pos ) ) ;
-  m_nword=m_lsubstring.size();
-}
-
-std::string StringParse::piece( const int & num ) {
-  if ( num <= m_nword ) return m_lsubstring[ num-1 ] ;
-  else return m_past_end;
-}
-
-int StringParse::intpiece( const int & num ) {  
-  if ( num <= m_nword ) {
-    int i = atoi( m_lsubstring[ num-1 ].c_str() ) ;
-    return i;
-  }
-  else return -1;
-}
-
-double StringParse::numpiece( const int & num ) {  
-  if ( num <= m_nword ) {
-    double x = atof( m_lsubstring[ num-1 ].c_str() ) ;
-    return x;
-  }
-  else return -1.1;
-}
-
-StringParse::~StringParse(){ }
diff --git a/Gen/Generators/src/Lib/cpyr.cpp b/Gen/Generators/src/Lib/cpyr.cpp
deleted file mode 100755
index ebb23129cb2bdb43079fcc7b289d12aefa7abd59..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/cpyr.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// $Id: cpyr.cpp,v 1.3 2007-10-10 20:07:24 robbep Exp $
-//-----------------------------------------------------------------------------
-// 06/05/2002 : Witold Pokorski
-//-----------------------------------------------------------------------------
-
-// plugs Gaudi RndmNumberSvc into Pythia
-
-//=============================================================================
-
-#include "GaudiKernel/RndmGenerators.h"
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/IRndmGen.h"
-#include "Generators/RandomForGenerator.h"
-
-#ifdef WIN32
-extern "C"  double __stdcall CPYR(int*)
-#else
-extern "C" double cpyr_(int*)
-#endif
-{  
-  return (RandomForGenerator::getNumbers())() ;
-}
-//=============================================================================
diff --git a/Gen/Generators/src/Lib/f77units.F b/Gen/Generators/src/Lib/f77units.F
deleted file mode 100755
index 52b25205c4a9bd353342d790e50a8b5d141a1972..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/f77units.F
+++ /dev/null
@@ -1,221 +0,0 @@
-C $Id: f77units.F,v 1.2 2007-06-29 13:21:06 ibelyaev Exp $
-C ----------------------------------------------------------------------
-C CVS tag $Name: not supported by cvs2svn $, version $Revision: 1.2 $
-C ----------------------------------------------------------------------
-C $Log: not supported by cvs2svn $
-C Revision 1.1  2006/10/04 13:36:46  ibelyaev
-C  add utilities to open/close Fortran file
-C 
-C ----------------------------------------------------------------------
-      INTEGER FUNCTION f77clfile ( LUN )
-C-----------------------------------------------------------------------
-C  Purpose   : close the opened F77 file with logical unit LUN
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       lun
-C-----------------------------------------------------------------------
-      CLOSE ( LUN , ERR=100 ) 
-      F77CLFILE = LUN 
-      RETURN 
- 100  CONTINUE 
-      WRITE(*,*) 'ERROR in closing file LUN=',LUN
-      F77CLFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77onfile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "NEW" file with logical unit LUN and name CHFILE 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE 
-C-----------------------------------------------------------------------
-      OPEN( LUN , FILE = CHFILE, STATUS='new' , ERR=100 ) 
-      F77ONFILE = LUN 
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "new" file LUN=',LUN,',NAME="',CHFILE,'"'
-      F77ONFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77oofile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "OLD" file with logical unit LUN and name CHFILE 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE
-C-----------------------------------------------------------------------
-      OPEN( LUN , FILE = CHFILE, STATUS='old' , ERR=100 ) 
-      F77OOFILE = LUN
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "old" file LUN=',LUN,',NAME="',CHFILE,'"'
-      F77OOFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77oufile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "UNKNOWN" file with logical unit LUN and name CHFILE
-C 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE
-C-----------------------------------------------------------------------
-      OPEN( LUN , FILE = CHFILE, STATUS='unknown' , ERR=100 ) 
-      F77OUFILE= LUN 
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "unknown" file LUN=',LUN,',NAME="',CHFILE
-     &  ,'"'
-      F77OUFILE = 1 
-      RETURN
-      END      
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77onffile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "NEW" FORMATTED file with logical unit LUN and name
-C              CHFILE 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE 
-C-----------------------------------------------------------------------
-      OPEN( LUN , 
-     &  FILE = CHFILE, STATUS='new' , FORM='formatted' , ERR =100 ) 
-      F77ONFFILE = LUN 
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "new"/"FORMATTED" file LUN=' , 
-     &  LUN,',NAME="',CHFILE,'"'
-      F77ONFFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77ooffile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "OLD" FORMATTED file with logical unit LUN and name
-C              CHFILE 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE 
-C-----------------------------------------------------------------------
-      OPEN( LUN , 
-     &  FILE = CHFILE, STATUS='old' , FORM='formatted' , ERR =100 ) 
-      F77OOFFILE = LUN 
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "old"/"FORMATTED" file LUN=' , 
-     &  LUN,',NAME="',CHFILE,'"'
-      F77OOFFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77ouffile ( LUN , CHFILE ) 
-C-----------------------------------------------------------------------
-C  Purpose   : open "UNKNOWN" "FORMATTED" file 
-C              with logical unit LUN and name CHFILE 
-C  Arguments : LUN units to be close 
-C
-C  @author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  @date      : 2006-10-03
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER       LUN
-      CHARACTER*(*) CHFILE 
-C-----------------------------------------------------------------------
-      OPEN( LUN , 
-     &  FILE = CHFILE, STATUS='unknown' , FORM='formatted' , ERR =100 ) 
-      F77OUFFILE = LUN 
-      RETURN 
- 100  CONTINUE
-      WRITE(*,*)'ERROR in open "unknown"/"FORMATTED" file LUN=' , 
-     &  LUN,',NAME="',CHFILE,'"'
-      F77OUFFILE = 0
-      RETURN
-      END
-C-----------------------------------------------------------------------
-      INTEGER FUNCTION f77GETUNIT ( N ) 
-C-----------------------------------------------------------------------
-C  Purpose   : search free fortran unit 
-C  Arguments : 
-C
-C  Author    : Vanya BELYAEV ibelyaev@physics.syr.edu
-C  Created   : 2007-06-28
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C-----------------------------------------------------------------------
-      INTEGER N 
-C-----------------------------------------------------------------------
-      INTEGER i
-      LOGICAL yes 
-C-----------------------------------------------------------------------
-      N = 0 
-      DO i = 99,10,-1           ! scal all units 
-        INQUIRE(unit=i,opened=yes)
-        IF ( .not. yes ) THEN
-          N = i 
-          GO TO 100
-        ENDIF
-      ENDDO
-C-----------------------------------------------------------------------
- 100  CONTINUE 
-      f77getunit = N 
- 999  RETURN
-      END
-      
-
-
-C-----------------------------------------------------------------------
-C The END 
-C-----------------------------------------------------------------------
diff --git a/Gen/Generators/src/Lib/getaddr.cpp b/Gen/Generators/src/Lib/getaddr.cpp
deleted file mode 100755
index 0f2976274dfd1bac4d6c1fcb91d2c91cbef8e740..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/getaddr.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// $Id: getaddr.cpp,v 1.1.1.1 2005-06-20 21:42:17 robbep Exp $
-////////////////////////////////////////////////////////////////////////
-// Routine meant to be called from FORTRAN which simply returns the
-// address of the (FORTRAN) argument. This should be 64bit-safe.
-//
-// 1999/01/08 Chris Green (Purdue University)
-// 1999/04/29 CG * altered to use void* from long*
-////////////////////////////////////////////////////////////////////////
-
-#ifdef WIN32
-extern "C" void* __stdcall GETADDR(void* arg) {
-  return(arg);
-}
-#else
-extern "C" {
-  void* getaddr_(void* arg);
-}
-
-void* getaddr_(void* arg) {
-  return(arg);
-}
-#endif
diff --git a/Gen/Generators/src/Lib/pythiaoutput_utils.F b/Gen/Generators/src/Lib/pythiaoutput_utils.F
deleted file mode 100755
index 3ae209063499727654950505217cdd38cbb882da..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/Lib/pythiaoutput_utils.F
+++ /dev/null
@@ -1,44 +0,0 @@
-C $Id: pythiaoutput_utils.F,v 1.5 2006-03-12 19:04:20 robbep Exp $
-      SUBROUTINE pythiaoutput_init( IVAL )
-C-----------------------------------------------------------------------
-C  Purpose   : Initialize Pythia output (suppress output)
-C  Arguments : IVAL : 0 -- Keep output   1 -- Suppress output
-C
-C  Author    : Patrick Robbe
-C  Created   : 2005-02-21
-C-----------------------------------------------------------------------
-      IMPLICIT NONE
-C- Include Files
-C- Local Variables
-C-----------------------------------------------------------------------
-      INTEGER IVAL
-      INTEGER MSTU, MSTJ
-      DOUBLE PRECISION PARU, PARJ
-      COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
-      INTEGER MSTP,MSTI
-      DOUBLE PRECISION PARP,PARI
-      COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200)
-      EXTERNAL PYDATA
-
-      IF ( IVAL.EQ.0 ) THEN
-        IF (MSTU(12).NE.12345) MSTU( 12 ) = 1
-        MSTU( 13 ) = 1
-        MSTU( 25 ) = 1
-        MSTP( 122 ) = 1
-      ELSEIF ( IVAL.EQ.1 ) THEN
-        IF (MSTU(11).NE.49) THEN
-          MSTU( 12 ) = 12345
-          MSTU( 13 ) = 0
-          MSTU( 25 ) = 0
-          MSTP( 122 ) = 0
-        ELSE
-          MSTU( 12 ) = 1 
-          MSTU( 13 ) = 1
-          MSTU( 25 ) = 1
-          MSTP( 122 ) = 1
-        ENDIF
-      ENDIF
-      
-  999 RETURN
-      END
-
diff --git a/Gen/Generators/src/component/ApplyPhotos.cpp b/Gen/Generators/src/component/ApplyPhotos.cpp
deleted file mode 100644
index 3eabd15bb52882bdbe9bc6bb73a5d9bbf6ec89dd..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/ApplyPhotos.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// $Id: $
-// Include files
-#include "Photos/Photos.h"
-#include "Photos/PhotosHepMCEvent.h"
-#include "Photos/PhotosHepMCParticle.h"
-#include "Photos/PhotosParticle.h"
-
-// Generators
-#include "Generators/RandomForGenerator.h"
-
-// from Gaudi
-
-// from Event
-#include "Event/HepMCEvent.h"
-
-// local
-#include "ApplyPhotos.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : ApplyPhotos
-//
-// 2011-05-27 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( ApplyPhotos )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-ApplyPhotos::ApplyPhotos( const std::string& name,
-                          ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator ) {
-    // Location of the input from the generation
-    declareProperty ( "HepMCEventLocation" , m_hepMCEventLocation =
-                      LHCb::HepMCEventLocation::Default ) ;
-    declareProperty ( "PDGId" , m_pdgIdList ) ;
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-ApplyPhotos::~ApplyPhotos() {}
-
-//=============================================================================
-// Initialization
-//=============================================================================
-StatusCode ApplyPhotos::initialize() {
-  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-
-  if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Initialize" << endmsg;
-
-  if ( m_pdgIdList.empty() ) 
-    return Error( "PDGId list property is not set" ) ;
-
-  for ( std::vector<int>::iterator it = m_pdgIdList.begin() ; 
-        it != m_pdgIdList.end() ; ++it ) m_pdgIds.insert( *it ) ;
-  
-  // Initialize PHOTOS
-  Photospp::Photos::initialize();
-  
-  // Give the Gauss random generator to Gauss 
-  // It is already initialized in Generation !
-  Photospp::Photos::setRandomGenerator( RandomForGenerator::flat );
-  // Set minimum photon energy (50keV at 1 GeV scale)
-  Photospp::Photos::setInfraredCutOff(1.e-7);
-  // Increase the maximum possible value of the interference weight
-  Photospp::Photos::maxWtInterference(64.0); // 2^n, where n = number of charges (+,-)
-  Photospp::Photos::setInterference( true ) ;
-  Photospp::Photos::setExponentiation( true ) ;
-
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode ApplyPhotos::execute() {
-
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
-
-  // Retrieve info from the TES
-  LHCb::HepMCEvents* theEvents =
-    get<LHCb::HepMCEvents>( m_hepMCEventLocation );
-
-  LHCb::HepMCEvents::iterator it ;
-
-  for ( it = theEvents -> begin() ; it != theEvents -> end() ; ++it ) {
-    HepMC::GenEvent * ev = (*it) -> pGenEvt() ;
-    for ( HepMC::GenEvent::particle_iterator itP = ev -> particles_begin() ;
-          itP != ev -> particles_end() ; ++itP ) {
-      if ( LHCb::HepMCEvent::DocumentationParticle != (*itP) -> status() ) {
-        if ( std::binary_search( m_pdgIds.begin() , m_pdgIds.end() , 
-                                 abs( (*itP) -> pdg_id() ) ) ) {
-          HepMC::GenVertex * EV = (*itP) -> end_vertex() ;
-          if ( 0 == EV ) continue ;
-
-          // Make one event with only the "signal" and its decay products
-          HepMC::GenEvent * newEvent = new HepMC::GenEvent( ) ;
-
-          // Fill the event
-          newEvent -> add_vertex( EV ) ;
-          HepMC::GenVertex::particle_iterator iterDes ;
-          for ( iterDes = EV -> particles_begin( HepMC::descendants ) ;
-                iterDes != EV -> particles_end( HepMC::descendants ) ; ++iterDes ) {
-            if ( 0 != (*iterDes) -> end_vertex() ) 
-              newEvent -> add_vertex( (*iterDes) -> end_vertex() ) ;
-          }
-
-         // Process the event in PHOTOS
-          Photospp::PhotosHepMCEvent photosEvent( newEvent );
-          photosEvent.process();
-
-          ev -> add_vertex( EV ) ;
-          for ( iterDes = EV -> particles_begin( HepMC::descendants ) ;
-                iterDes != EV -> particles_end( HepMC::descendants ) ; ++iterDes ) {
-            if ( 0 != (*iterDes) -> end_vertex() ) 
-              ev -> add_vertex( (*iterDes) -> end_vertex() ) ;
-          }
-        }
-      }
-    }
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode ApplyPhotos::finalize() {
-
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
-
-  return GaudiAlgorithm::finalize();  // must be called after all other actions
-}
-
-//=============================================================================
-
diff --git a/Gen/Generators/src/component/ApplyPhotos.h b/Gen/Generators/src/component/ApplyPhotos.h
deleted file mode 100644
index 90d4dc1fcd0c5195a64869b94230a54585b72d10..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/ApplyPhotos.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// $Id: $
-#ifndef GENERATORS_APPLYPHOTOS_H
-#define GENERATORS_APPLYPHOTOS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class ApplyPhotos ApplyPhotos.h component/ApplyPhotos.h
- *  Class to apply photos on a given particle
- *
- *  @author Patrick Robbe
- *  @date   2011-05-27
- */
-class ApplyPhotos : public GaudiAlgorithm {
-public:
-  /// Standard constructor
-  ApplyPhotos( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~ApplyPhotos( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
-
-protected:
-
-private:
-
-  std::string  m_hepMCEventLocation ;    ///< Input TES for HepMC events
-
-  std::vector< int > m_pdgIdList    ;    ///< list of the particle ID to study
-  std::set   < int > m_pdgIds       ;    ///< ordered list of PDG Ids
-};
-#endif // GENERATORS_APPLYPHOTOS_H
diff --git a/Gen/Generators/src/component/AsymmetricCollidingBeams.cpp b/Gen/Generators/src/component/AsymmetricCollidingBeams.cpp
deleted file mode 100755
index 9c5ceb8b64fa7ce46375ff62df495c7b3c6b695b..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/AsymmetricCollidingBeams.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// Include files 
-
-// local
-#include "AsymmetricCollidingBeams.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-
-// From Kernel
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "GenEvent/BeamForInitialization.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : AsymmetricCollidingBeams
-//
-// 2016-10-27 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( AsymmetricCollidingBeams )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-AsymmetricCollidingBeams::AsymmetricCollidingBeams( const std::string& type,
-                                                    const std::string& name,
-                                                    const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IBeamTool >( this ) ;
-    declareProperty( "BeamParameters" , 
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-    declareProperty( "Beam2Momentum" , 
-                     m_beam2_zMomentum = 0. ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-AsymmetricCollidingBeams::~AsymmetricCollidingBeams( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode AsymmetricCollidingBeams::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  
-  sc = m_gaussianDist.initialize( randSvc , Rndm::Gauss( 0. , 1. ) )  ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize Gaussian random generator" , sc ) ;
-  release( randSvc ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Mean value of the beam momentum
-//=============================================================================
-void AsymmetricCollidingBeams::getMeanBeams( Gaudi::XYZVector & pBeam1 , 
-                                             Gaudi::XYZVector & pBeam2 )
-  const {
-  // Retrieve beam parameters from the static class
-  LHCb::BeamParameters * beam = 
-    BeamForInitialization::getInitialBeamParameters() ;
-  if ( 0 == beam ) 
-    Exception( "No beam parameters in initialization" ) ;
-
-  double p1x, p1y, p1z, p2x, p2y, p2z ;
-  
-  p1x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() +
-         beam -> horizontalBeamlineAngle() ) ;
-  p1y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() + 
-         beam -> verticalBeamlineAngle() ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-
-  p2x = m_beam2_zMomentum * 
-    sin( beam -> horizontalCrossingAngle() - 
-         beam -> horizontalBeamlineAngle() ) ;
-  p2y = m_beam2_zMomentum * 
-    sin( beam -> verticalCrossingAngle() - 
-         beam -> verticalBeamlineAngle() ) ;
-  p2z = -m_beam2_zMomentum ;
-  pBeam2.SetXYZ( p2x, p2y, p2z ) ;
-}
-
-//=============================================================================
-// Current value of the smeared beams
-//=============================================================================
-void AsymmetricCollidingBeams::getBeams( Gaudi::XYZVector & pBeam1 , 
-                               Gaudi::XYZVector & pBeam2 ) {
-  // Retrieve beam parameters
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters in TES" ) ;
-
-  double p1x, p1y, p1z, p2x, p2y, p2z ;
-  p1x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() + 
-         beam -> horizontalBeamlineAngle() + 
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p1y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() + 
-         beam -> verticalBeamlineAngle() +
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-
-  p2x = m_beam2_zMomentum * 
-    sin( beam -> horizontalCrossingAngle() - 
-         beam -> horizontalBeamlineAngle() + 
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p2y = m_beam2_zMomentum  * 
-    sin( beam -> verticalCrossingAngle() - 
-         beam -> verticalBeamlineAngle() +
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p2z = -m_beam2_zMomentum ;
-  pBeam2.SetXYZ( p2x, p2y, p2z ) ;
-}
diff --git a/Gen/Generators/src/component/AsymmetricCollidingBeams.h b/Gen/Generators/src/component/AsymmetricCollidingBeams.h
deleted file mode 100755
index 4383fcafd2b33d6911f8e2168449cbadc1e02b0a..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/AsymmetricCollidingBeams.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef GENERATORS_ASYMMETRICCOLLIDINGBEAMS_H
-#define GENERATORS_ASYMMETRICCOLLIDINGBEAMS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IBeamTool.h"
-
-// Forward declarations
-class IRndmGenSvc ;
-
-/** @class AsymmetricCollidingBeams AsymmetricCollidingBeams.h "AsymmetricCollidingBeams.h"
- *
- *  Tool to compute colliding beams values, with asymmetric beams.
- *  Concrete implementation
- *  of a beam tool.
- *
- *  @author Patrick Robbe
- *  @date   2016-10-27
- */
-class AsymmetricCollidingBeams : public GaudiTool, virtual public IBeamTool {
- public:
-  /// Standard constructor
-  AsymmetricCollidingBeams( const std::string& type, const std::string& name,
-                            const IInterface* parent ) ;
-
-  virtual ~AsymmetricCollidingBeams( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IBeamTool::getMeanBeams
-   */
-  void getMeanBeams( Gaudi::XYZVector & pBeam1 ,
-                     Gaudi::XYZVector & pBeam2 ) const override;
-
-  /** Implements IBeamTool::getBeams
-   *  Compute beam 3-momentum taking into account the horizontal and vertical
-   *  beam angles (given by job options). These angles are Gaussian-smeared
-   *  with an angular smearing equal to (emittance/beta*)^1/2.
-   */
-  void getBeams( Gaudi::XYZVector & pBeam1 ,
-                 Gaudi::XYZVector & pBeam2 ) override;
-
- private:
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-  double m_beam2_zMomentum ; ///< Energy of the second beam (beam 2)
-
-  Rndm::Numbers m_gaussianDist ; ///< Gaussian random number generator
-};
-#endif // GENERATORS_ASYMMETRICCOLLIDINGBEAMS_H
diff --git a/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.cpp b/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.cpp
deleted file mode 100644
index 163864596e6fa735f2855100691489fed7c7ef84..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-
-// local
-#include "BeamSpotMarkovChainSampleVertex.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : LHCbAcceptance
-//
-// 2016-10-10 : Floris Keizer
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-BeamSpotMarkovChainSampleVertex::
-BeamSpotMarkovChainSampleVertex( const std::string& type,
-                                 const std::string& name,
-                                 const IInterface* parent )
-  : GaudiTool ( type, name , parent )
-{
-  declareInterface< IVertexSmearingTool >( this ) ;
-  declareProperty( "Xcut" , m_xcut = 4. ) ; // times SigmaX
-  declareProperty( "Ycut" , m_ycut = 4. ) ; // times SigmaY
-  declareProperty( "Zcut" , m_zcut = 4. ) ; // times SigmaZ
-  declareProperty( "BeamParameters" ,
-                   m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-  declareProperty( "NMarkovChainSamples", m_nMCSamples = 1000 );
-}
-
-//=============================================================================
-// Initialize
-//=============================================================================
-StatusCode BeamSpotMarkovChainSampleVertex::initialize( )
-{
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  // Gaussians used to perturb the four-vector in the Markov chain
-  // The standard deviation of the pertubation should reflect (about 10%)
-  // the width of the function that is sampled from.
-  // However, it is not sensitive to the precise value... changing for example
-  // the sigma in m_gaussDistZ from 5. to 7. will not make a difference.
-
-  sc = StatusCode( sc
-         && m_gaussDistX.initialize( randSvc , Rndm::Gauss( 0. , 0.025  ) )
-         && m_gaussDistY.initialize( randSvc , Rndm::Gauss( 0. , 0.025  ) )
-         && m_gaussDistZ.initialize( randSvc , Rndm::Gauss( 0. , 5.     ) )
-         && m_gaussDistT.initialize( randSvc , Rndm::Gauss( 0. , 1.     ) )
-         && m_flatDist.initialize  ( randSvc , Rndm::Flat ( 0. , 1.     ) ) );
-  if ( sc.isFailure() )
-  { return Error( "Could not initialize random number generators" ); }
-
-  release( randSvc ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Function representing the product of two 4D Gaussian PDFs (Floris)
-//=============================================================================
-double BeamSpotMarkovChainSampleVertex::gauss4D( LHCb::BeamParameters * beamp ,
-                                                 const HepMC::FourVector & vec ) const
-{
-  const auto emittance = beamp -> emittance();
-  const auto betastar  = beamp -> betaStar();
-  const auto aX        = beamp -> horizontalCrossingAngle();
-  const auto aY        = beamp -> verticalCrossingAngle();
-
-  const auto c  = Gaudi::Units::c_light ;
-  const auto Pi = Gaudi::Units::pi;
-
-  const auto sx = std::sqrt( emittance*betastar );
-  const auto sy = sx;
-  const auto sz = beamp -> sigmaS();// RMS bunch length in mm
-
-  const auto x = vec.x();
-  const auto y = vec.y();
-  const auto z = vec.z();
-  const auto t = vec.t();
-
-  const auto sX2 = std::pow( sx ,2 );
-  const auto sY2 = std::pow( sy ,2 );
-  const auto sZ2 = std::pow( sz ,2 );
-  const auto x2 = std::pow( x , 2 );
-  const auto y2 = std::pow( y , 2 );
-  const auto z2 = std::pow( z , 2 );
-  const auto t2 = std::pow( t , 2 );
-  const auto c2 = std::pow(c,2);
-
-  const auto c2m3 = std::cos(2*aX - 3*aY);
-  const auto c4m2 = std::cos(4*aX - 2*aY);
-  const auto c04 = std::cos(4*aY);
-  const auto c20 = std::cos(2*aX);
-  const auto c40 = std::cos(4*aX);
-  const auto c2m2 = std::cos(2*(aX - aY));
-  const auto c2m1 = std::cos(2*aX - aY);
-  const auto c4m1 = std::cos(4*aX - aY);
-  const auto c01 = std::cos(aY);
-  const auto c02 = std::cos(2*aY);
-  const auto c03 = std::cos(3*aY);
-  const auto c2p2 = std::cos(2*(aX + aY));
-  const auto c4p4 = std::cos(4*(aX + aY));
-  const auto c4p2 = std::cos(2*(2*aX + aY));
-  const auto c2p4 = std::cos(2*(aX + 2*aY));
-  const auto c2p3 = std::cos(2*aX + 3*aY);
-  const auto c4p3 = std::cos(4*aX + 3*aY);
-  const auto c2p1 = std::cos(2*aX + aY);
-  const auto s10 = std::sin(aX);
-  const auto s30 = std::sin(3*aX);
-  const auto s1m3 = std::sin(aX - 3*aY);
-  const auto s1m2 = std::sin(aX - 2*aY);
-  const auto s3m2 = std::sin(3*aX - 2*aY);
-  const auto s1m1 = std::sin(aX - aY);
-  const auto s3m1 = std::sin(3*aX - aY);
-  const auto s1p1 = std::sin(aX + aY);
-  const auto s3p3 = std::sin(3*(aX + aY));
-  const auto s3p1 = std::sin(3*aX + aY);
-  const auto s1p2 = std::sin(aX + 2*aY);
-  const auto s3p2 = std::sin(3*aX + 2*aY);
-  const auto s1p3 = std::sin(aX + 3*aY);
-
-  // finally, return the function...
-  // This is computed from the Mathematica notebook primaryVertexPDF.nb
-  return std::exp((-700 - (800*sZ2)/sX2 - (900*sZ2)/sY2 + (140*c*t)/sz + (160*c*sz*t)/sX2 + (180*c*sz*t)/sY2 - (8*c2*t2)/sX2 - (9*c2*t2)/sY2 - (7*c2*t2)/sZ2 - (16*x2)/sX2 - (8*x2)/sY2 - (8*x2)/sZ2 - (16*y2)/sY2 - (16*y2)/sZ2 - (16*z2)/sX2 - (8*z2)/sY2 - (8*z2)/sZ2 - (2*(-2*sY2*sZ2*std::pow(-10*sz + c*t,2) + sX2*(sZ2*(300*sZ2 - 60*c*sz*t + 3*c2*t2 - 4*(x2 - 2*y2 + z2)) + sY2*(300*sZ2 - 60*c*sz*t + 3*c2*t2 + 4*(x2 - 2*y2 + z2))))*c20)/(sX2*sY2*sZ2) + ((sY2 - sZ2)*std::pow(-10*sz + c*t,2)*c40)/(sY2*sZ2) + 200*c2m3 - (200*sZ2*c2m3)/sY2 - (40*c*t*c2m3)/sz + (40*c*sz*t*c2m3)/sY2 - (2*c2*t2*c2m3)/sY2 + (2*c2*t2*c2m3)/sZ2 - 100*c4m2 + (100*sZ2*c4m2)/sY2 + (20*c*t*c4m2)/sz - (20*c*sz*t*c4m2)/sY2 + (c2*t2*c4m2)/sY2 - (c2*t2*c4m2)/sZ2 - 200*c2m2 + (600*sZ2*c2m2)/sY2 + (40*c*t*c2m2)/sz - (120*c*sz*t*c2m2)/sY2 + (6*c2*t2*c2m2)/sY2 - (2*c2*t2*c2m2)/sZ2 - (4*x2*c2m2)/sY2 + (4*x2*c2m2)/sZ2 + (4*z2*c2m2)/sY2 - (4*z2*c2m2)/sZ2 + 200*c2m1 - (200*sZ2*c2m1)/sY2 - (40*c*t*c2m1)/sz + (40*c*sz*t*c2m1)/sY2 - (2*c2*t2*c2m1)/sY2 + (2*c2*t2*c2m1)/sZ2 + (16*x*y*c2m1)/sY2 - (16*x*y*c2m1)/sZ2 + 200*c4m1 - (200*sZ2*c4m1)/sY2 - (40*c*t*c4m1)/sz + (40*c*sz*t*c4m1)/sY2 - (2*c2*t2*c4m1)/sY2 + (2*c2*t2*c4m1)/sZ2 - 200*c01 + (200*sZ2*c01)/sY2 + (40*c*t*c01)/sz - (40*c*sz*t*c01)/sY2 + (2*c2*t2*c01)/sY2 - (2*c2*t2*c01)/sZ2 - 400*c02 - (800*sZ2*c02)/sX2 + (400*sZ2*c02)/sY2 + (80*c*t*c02)/sz + (160*c*sz*t*c02)/sX2 - (80*c*sz*t*c02)/sY2 - (8*c2*t2*c02)/sX2 + (4*c2*t2*c02)/sY2 - (4*c2*t2*c02)/sZ2 - (16*x2*c02)/sX2 + (8*x2*c02)/sY2 + (8*x2*c02)/sZ2 + (16*z2*c02)/sX2 - (8*z2*c02)/sY2 - (8*z2*c02)/sZ2 + 200*c03 - (200*sZ2*c03)/sY2 - (40*c*t*c03)/sz + (40*c*sz*t*c03)/sY2 - (2*c2*t2*c03)/sY2 + (2*c2*t2*c03)/sZ2 - 100*c04 + (100*sZ2*c04)/sY2 + (20*c*t*c04)/sz - (20*c*sz*t*c04)/sY2 + (c2*t2*c04)/sY2 - (c2*t2*c04)/sZ2 - 600*c2p2 + (800*sZ2*c2p2)/sX2 + (200*sZ2*c2p2)/sY2 + (120*c*t*c2p2)/sz - (160*c*sz*t*c2p2)/sX2 - (40*c*sz*t*c2p2)/sY2 + (8*c2*t2*c2p2)/sX2 + (2*c2*t2*c2p2)/sY2 - (6*c2*t2*c2p2)/sZ2 - (4*x2*c2p2)/sY2 + (4*x2*c2p2)/sZ2 + (4*z2*c2p2)/sY2 - (4*z2*c2p2)/sZ2 - 100*c4p4 + (100*sZ2*c4p4)/sY2 + (20*c*t*c4p4)/sz - (20*c*sz*t*c4p4)/sY2 + (c2*t2*c4p4)/sY2 - (c2*t2*c4p4)/sZ2 - 200*c2p1 + (200*sZ2*c2p1)/sY2 + (40*c*t*c2p1)/sz - (40*c*sz*t*c2p1)/sY2 + (2*c2*t2*c2p1)/sY2 - (2*c2*t2*c2p1)/sZ2 - (16*x*y*c2p1)/sY2 + (16*x*y*c2p1)/sZ2 - 300*c4p2 + (300*sZ2*c4p2)/sY2 + (60*c*t*c4p2)/sz - (60*c*sz*t*c4p2)/sY2 + (3*c2*t2*c4p2)/sY2 - (3*c2*t2*c4p2)/sZ2 - 200*c2p4 + (400*sZ2*c2p4)/sX2 - (200*sZ2*c2p4)/sY2 + (40*c*t*c2p4)/sz - (80*c*sz*t*c2p4)/sX2 + (40*c*sz*t*c2p4)/sY2 +  (4*c2*t2*c2p4)/sX2 - (2*c2*t2*c2p4)/sY2 - (2*c2*t2*c2p4)/sZ2 - 200*c2p3 + (200*sZ2*c2p3)/sY2 + (40*c*t*c2p3)/sz - (40*c*sz*t*c2p3)/sY2 + (2*c2*t2*c2p3)/sY2 - (2*c2*t2*c2p3)/sZ2 - 200*c4p3 +  (200*sZ2*c4p3)/sY2 + (40*c*t*c4p3)/sz - (40*c*sz*t*c4p3)/sY2 + (2*c2*t2*c4p3)/sY2 - (2*c2*t2*c4p3)/sZ2 + (80*x*s10)/sz - (80*sz*x*s10)/sY2 + (8*c*t*x*s10)/sY2 - (8*c*t*x*s10)/sZ2 - (80*y*s10)/sz + (80*sz*y*s10)/sY2 - (8*c*t*y*s10)/sY2 + (8*c*t*y*s10)/sZ2 + (80*x*s30)/sz - (80*sz*x*s30)/sY2 + (8*c*t*x*s30)/sY2 - (8*c*t*x*s30)/sZ2 - (80*y*s30)/sz + (80*sz*y*s30)/sY2 - (8*c*t*y*s30)/sY2 + (8*c*t*y*s30)/sZ2 + (40*x*s1m3)/sz - (40*sz*x*s1m3)/sY2 + (4*c*t*x*s1m3)/sY2 - (4*c*t*x*s1m3)/sZ2 - (40*x*s1m2)/sz + (40*sz*x*s1m2)/sY2 - (4*c*t*x*s1m2)/sY2 + (4*c*t*x*s1m2)/sZ2 - (80*y*s1m2)/sz +  (80*sz*y*s1m2)/sY2 - (8*c*t*y*s1m2)/sY2 + (8*c*t*y*s1m2)/sZ2 - (40*x*s3m2)/sz + (40*sz*x*s3m2)/sY2 - (4*c*t*x*s3m2)/sY2 + (4*c*t*x*s3m2)/sZ2 + (80*x*s1m1)/sz + (160*sz*x*s1m1)/sX2 + (80*sz*x*s1m1)/sY2 - (16*c*t*x*s1m1)/sX2 - (8*c*t*x*s1m1)/sY2 - (8*c*t*x*s1m1)/sZ2 - (80*y*s1m1)/sz - (240*sz*y*s1m1)/sY2 + (24*c*t*y*s1m1)/sY2 + (8*c*t*y*s1m1)/sZ2 + (40*x*s3m1)/sz - (40*sz*x*s3m1)/sY2 + (4*c*t*x*s3m1)/sY2 - (4*c*t*x*s3m1)/sZ2 + (80*y*s3m1)/sz - (80*sz*y*s3m1)/sY2 + (8*c*t*y*s3m1)/sY2 - (8*c*t*y*s3m1)/sZ2 - (40*x*s1p1)/sz + (320*sz*x*s1p1)/sX2 + (40*sz*x*s1p1)/sY2 - (32*c*t*x*s1p1)/sX2 - (4*c*t*x*s1p1)/sY2 + (4*c*t*x*s1p1)/sZ2 + (80*y*s1p1)/sz + (240*sz*y*s1p1)/sY2 - (24*c*t*y*s1p1)/sY2 - (8*c*t*y*s1p1)/sZ2 - (40*x*s3p3)/sz + (40*sz*x*s3p3)/sY2 - (4*c*t*x*s3p3)/sY2 + (4*c*t*x*s3p3)/sZ2 - (80*y*s3p1)/sz + (80*sz*y*s3p1)/sY2 - (8*c*t*y*s3p1)/sY2 + (8*c*t*y*s3p1)/sZ2 - (40*x*s1p2)/sz + (40*sz*x*s1p2)/sY2 - (4*c*t*x*s1p2)/sY2 + (4*c*t*x*s1p2)/sZ2 - (40*x*s3p2)/sz + (40*sz*x*s3p2)/sY2 - (4*c*t*x*s3p2)/sY2 + (4*c*t*x*s3p2)/sZ2 - (80*y*s3p2)/sz + (80*sz*y*s3p2)/sY2 - (8*c*t*y*s3p2)/sY2 + (8*c*t*y*s3p2)/sZ2 - (80*x*s1p3)/sz + (160*sz*x*s1p3)/sX2 - (80*sz*x*s1p3)/sY2 - (16*c*t*x*s1p3)/sX2 + (8*c*t*x*s1p3)/sY2 + (8*c*t*x*s1p3)/sZ2)/32.)/(8.*std::pow(Pi,3)*sX2*sY2*sZ2);
-}
-
-//=============================================================================
-// Markov chain sampler
-//=============================================================================
-StatusCode BeamSpotMarkovChainSampleVertex::smearVertex( LHCb::HepMCEvent * theEvent )
-{
-
-  LHCb::BeamParameters * beamp = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( ! beamp ) Exception( "No beam parameters registered" ) ;
-
-  // The sampled point. Always start at origin for reproducibility.
-  HepMC::FourVector x( 0 , 0 , 0 , 0 );
-
-  // Repeat until we get a sampled point within the defined (x,,y,z) limits
-  unsigned int iLoop = 0; // sanity check to prevent infinite loops...
-  bool OK = false;
-  while ( iLoop++ < m_nMCSamples && !OK )
-  {
-    for ( unsigned int repeat = 0; repeat < m_nMCSamples; ++repeat )
-    {
-      // Copute the PDF value for this point
-      const auto f = gauss4D( beamp , x );
-
-      // smear the point. random walk.
-      const HepMC::FourVector y( x.x() + m_gaussDistX(),
-                                 x.y() + m_gaussDistY(),
-                                 x.z() + m_gaussDistZ(),
-                                 x.t() + m_gaussDistT() );
-
-      // compute the prob for the new point
-      const auto g = gauss4D( beamp , y );
-
-      if ( f < g )
-      {
-        // new point is better, so always keep
-        x = y;
-      }
-      else
-      {
-        // randomly keep worse point a fraction depending on the prob values.
-        const auto ratio = ( fabs(f)>0 ? g/f : 0.0 );
-        const auto r = m_flatDist( );
-        if ( r < ratio ) { x = y; }
-      }
-    }
-
-    // Check final if the spatial part of x is within the defined limits.
-    OK = ( ( fabs(x.x()) < ( m_xcut * beamp->sigmaX() ) ) &&
-           ( fabs(x.y()) < ( m_ycut * beamp->sigmaY() ) ) &&
-           ( fabs(x.z()) < ( m_zcut * beamp->sigmaZ() ) ) );
-
-    // reset and repeat
-    if ( !OK ) { x = HepMC::FourVector(0,0,0,0); }
-
-  }
-  if ( UNLIKELY(!OK) )
-  {
-    Warning( "Markov Chain sampling for PV (x,y,z,t) failed" ).ignore();
-  }
-  else
-  {
-
-    // A shift to put the mean of the temporal distribution at t=0.// Factor 10 because the bunches
-    // start 10*sigmaZ away from the interaction point.
-    const auto timeDelay = 10*(beamp -> sigmaS())/Gaudi::Units::c_light;
-
-    // Shift the sampled point to average beam spot position and time offset
-    x.setT( x.t() - timeDelay );
-    x.setX( x.x() + beamp -> beamSpot().x() ); // Offset the centre of the beamspot
-    x.setY( x.y() + beamp -> beamSpot().y() );
-    x.setZ( x.z() + beamp -> beamSpot().z() );
-
-    // update the values for all vertices
-    auto * pEvt = theEvent -> pGenEvt() ;
-    if ( pEvt )
-    {
-      for ( auto vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; ++vit )
-      {
-        const auto pos = (*vit) -> position() ;
-        (*vit) -> set_position( HepMC::FourVector( pos.x() + x.x() ,
-                                                   pos.y() + x.y() ,
-                                                   pos.z() + x.z() ,
-                                                   pos.t() + x.t() ) ) ;
-      }
-    }
-
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( BeamSpotMarkovChainSampleVertex )
diff --git a/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.h b/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.h
deleted file mode 100644
index ca2c62cb21c4d1bba0b947676a253d5dfb2a0b81..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/BeamSpotMarkovChainSampleVertex.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef GENERATORS_BeamSpotMarkovChainSampleVertex_H
-#define GENERATORS_BeamSpotMarkovChainSampleVertex_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/PhysicalConstants.h"
-
-// from Event
-#include "Event/HepMCEvent.h"
-#include "Event/BeamParameters.h"
-
-#include "Generators/IVertexSmearingTool.h"
-
-/** @class BeamSpotMarkovChainSampleVertex BeamSpotMarkovChainSampleVertex.h
- *
- *  VertexSmearingTool to sample the (x,y,z,t) parameters from a 4D PDF
- *  that describes the intersection of two bunches.
- *
- *  @author Floris Keizer
- *  @author Chris Jones
- *  @date   2016-10-10
- */
-class BeamSpotMarkovChainSampleVertex final : public GaudiTool,
-                                              virtual public IVertexSmearingTool
-{
-
-public:
-
-  /// Standard constructor
-  BeamSpotMarkovChainSampleVertex( const std::string& type,
-                                   const std::string& name,
-                                   const IInterface* parent );
-
-
-  /// Initialize function
-  StatusCode initialize( ) override;
-
-  /** Implementation of IVertexSmearingTool::smearVertex.
-   *  Gaussian smearing of spatial position of primary event truncated
-   *  at a given number of sigma.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-
-  //=============================================================================
-  // Test function to try Markov chain
-  //=============================================================================
-  // inline double tophat( const HepMC::FourVector& x ) const noexcept
-  // {
-  //   return ( (fabs(x.x())<2.0) &&
-  //            (fabs(x.y())<2.0) &&
-  //            (fabs(x.z())<2.0) &&
-  //            (fabs(x.t())<2.0) ? 2.0 : 0.000001 );
-  // }
-
-  //=============================================================================
-  // Test function to try Markov chain
-  //=============================================================================
-  // double triangle( const HepMC::FourVector& x ) const noexcept
-  // {
-  //   return ( x.t() < 0.0 ? 0.0 :
-  //            x.t() < 2.0 ? 2.0 - x.t() :
-  //            0.0 );
-  // }
-
-  /// Probability distribution in 4D
-  double gauss4D( LHCb::BeamParameters * beamp ,
-                  const HepMC::FourVector & vec ) const;
-
- private:
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  /// Number of Markov Chain sampling iterations
-  unsigned int m_nMCSamples;
-
-  /// Number of sigma above which to cut for x-axis smearing (set by options)
-  double m_xcut;
-  /// Number of sigma above which to cut for y-axis smearing (set by options)
-  double m_ycut;
-  /// Number of sigma above which to cut for z-axis smearing (set by options)
-  double m_zcut;
-
-  //  Rndm::Numbers m_gaussDist ; ///< Gaussian random number generator
-  Rndm::Numbers m_gaussDistX ; ///< Gaussian random number generator for Markov chain pertubation in x
-  Rndm::Numbers m_gaussDistY ; ///< Gaussian random number generator for Markov chain pertubation in y
-  Rndm::Numbers m_gaussDistZ ; ///< Gaussian random number generator for Markov chain pertubation in z
-  Rndm::Numbers m_gaussDistT ; ///< Gaussian random number generator for Markov chain pertubation in t
-  Rndm::Numbers m_flatDist ; ///< Random number generator (between 0 and 1)
-
-};
-
-#endif // GENERATORS_BeamSpotMarkovChainSampleVertex_H
diff --git a/Gen/Generators/src/component/BeamSpotSmearVertex.cpp b/Gen/Generators/src/component/BeamSpotSmearVertex.cpp
deleted file mode 100755
index d129d6fbefa9e99ce027f528ea55c25cd664d3c9..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/BeamSpotSmearVertex.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// $Id: BeamSpotSmearVertex.cpp,v 1.12 2010-05-09 17:05:42 gcorti Exp $
-// Include files 
-
-// local
-#include "BeamSpotSmearVertex.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/PhysicalConstants.h" 
-
-// from Event
-#include "Event/HepMCEvent.h"
-#include "Event/BeamParameters.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : LHCbAcceptance
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( BeamSpotSmearVertex )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-BeamSpotSmearVertex::BeamSpotSmearVertex( const std::string& type,
-                                          const std::string& name,
-                                          const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IVertexSmearingTool >( this ) ;
-    declareProperty( "Xcut" , m_xcut = 4. ) ; // times SigmaX 
-    declareProperty( "Ycut" , m_ycut = 4. ) ; // times SigmaY
-    declareProperty( "Zcut" , m_zcut = 4. ) ; // times SigmaZ
-    declareProperty( "SignOfTimeVsT0", m_timeSignVsT0 = 0 ) ;
-    declareProperty( "BeamParameters" , 
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-BeamSpotSmearVertex::~BeamSpotSmearVertex( ) { ; }
-
-//=============================================================================
-// Initialize 
-//=============================================================================
-StatusCode BeamSpotSmearVertex::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-  
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  sc = m_gaussDist.initialize( randSvc , Rndm::Gauss( 0. , 1. ) ) ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize gaussian random number generator" ) ;
-
-    
-  info() << "Smearing of interaction point with Gaussian distribution "
-         << endmsg;
-
-  release( randSvc ) ;
- 
-  return sc ;
-}
-
-//=============================================================================
-// Smearing function
-//=============================================================================
-StatusCode BeamSpotSmearVertex::smearVertex( LHCb::HepMCEvent * theEvent ) {
-
-  LHCb::BeamParameters * beamp = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beamp ) Exception( "No beam parameters registered" ) ;
-
-  double dx , dy , dz;
-  
-  do { dx = m_gaussDist( ) ; } while ( fabs( dx ) > m_xcut ) ;
-  dx = dx * beamp -> sigmaX() + beamp -> beamSpot().x() ;
-  do { dy = m_gaussDist( ) ; } while ( fabs( dy ) > m_ycut ) ;
-  dy = dy * beamp -> sigmaY() + beamp -> beamSpot().y() ;
-  do { dz = m_gaussDist( ) ; } while ( fabs( dz ) > m_zcut ) ;
-  dz = dz * beamp -> sigmaZ() + beamp -> beamSpot().z() ;
-
-  double meanT = m_timeSignVsT0 * beamp -> beamSpot().z() / Gaudi::Units::c_light ;
-
-  HepMC::FourVector dpos( dx , dy , dz , meanT ) ;
-  
-  HepMC::GenEvent::vertex_iterator vit ;
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-  for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; 
-        ++vit ) {
-     HepMC::FourVector pos = (*vit) -> position() ;
-    (*vit) -> set_position( HepMC::FourVector( pos.x() + dpos.x() , 
-                                               pos.y() + dpos.y() , 
-                                               pos.z() + dpos.z() , 
-                                               pos.t() + dpos.t() ) ) ;
-  }
-
-  return StatusCode::SUCCESS ;      
-}
-
diff --git a/Gen/Generators/src/component/BeamSpotSmearVertex.h b/Gen/Generators/src/component/BeamSpotSmearVertex.h
deleted file mode 100755
index d87b37ecdbfc19a0d40008b75923ac28bc1193ac..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/BeamSpotSmearVertex.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id: BeamSpotSmearVertex.h,v 1.7 2010-05-09 17:05:43 gcorti Exp $
-#ifndef GENERATORS_BEAMSPOTSMEARVERTEX_H
-#define GENERATORS_BEAMSPOTSMEARVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IVertexSmearingTool.h"
-
-/** @class BeamSpotSmearVertex BeamSpotSmearVertex.h "BeamSpotSmearVertex.h"
- *
- *  VertexSmearingTool to smear vertex according to beam spot parameters.
- *  Concrete implementation of IVertexSmearingTool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-24
- */
-class BeamSpotSmearVertex : public GaudiTool,
-                            virtual public IVertexSmearingTool {
-public:
-  /// Standard constructor
-  BeamSpotSmearVertex( const std::string& type, const std::string& name,
-                       const IInterface* parent);
-
-  virtual ~BeamSpotSmearVertex( ); ///< Destructor
-
-  /// Initialize function
-  StatusCode initialize( ) override;
-
-  /** Implementation of IVertexSmearingTool::smearVertex.
-   *  Gaussian smearing of spatial position of primary event truncated
-   *  at a given number of sigma.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-  /// Number of sigma above which to cut for x-axis smearing (set by options)
-  double m_xcut   ;
-
-  /// Number of sigma above which to cut for y-axis smearing (set by options)
-  double m_ycut   ;
-
-  /// Number of sigma above which to cut for z-axis smearing (set by options)
-  double m_zcut   ;
-
-  /// Sign of time of interaction as given from position with respect to
-  /// origin
-  int  m_timeSignVsT0 ;
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  Rndm::Numbers m_gaussDist ; ///< Gaussian random number generator
-
-};
-#endif // GENERATORS_BEAMSPOTSMEARVERTEX_H
diff --git a/Gen/Generators/src/component/CollidingBeams.cpp b/Gen/Generators/src/component/CollidingBeams.cpp
deleted file mode 100755
index d7e758f61df05754f1bc05078ebc880d48099e68..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/CollidingBeams.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// $Id: CollidingBeams.cpp,v 1.5 2007-02-08 17:46:06 gcorti Exp $
-// Include files 
-
-// local
-#include "CollidingBeams.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-
-// From Kernel
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "GenEvent/BeamForInitialization.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : CollidingBeams
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( CollidingBeams )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-CollidingBeams::CollidingBeams( const std::string& type,
-                                const std::string& name,
-                                const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IBeamTool >( this ) ;
-    declareProperty( "BeamParameters" , 
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-CollidingBeams::~CollidingBeams( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode CollidingBeams::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  
-  sc = m_gaussianDist.initialize( randSvc , Rndm::Gauss( 0. , 1. ) )  ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize Gaussian random generator" , sc ) ;
-  release( randSvc ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Mean value of the beam momentum
-//=============================================================================
-void CollidingBeams::getMeanBeams( Gaudi::XYZVector & pBeam1 , 
-                                   Gaudi::XYZVector & pBeam2 )
-  const {
-  // Retrieve beam parameters from the static class
-  LHCb::BeamParameters * beam = 
-    BeamForInitialization::getInitialBeamParameters() ;
-  if ( 0 == beam ) 
-    Exception( "No beam parameters in initialization" ) ;
-
-  double p1x, p1y, p1z, p2x, p2y, p2z ;
-  
-  p1x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() +
-         beam -> horizontalBeamlineAngle() ) ;
-  p1y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() + 
-         beam -> verticalBeamlineAngle() ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-
-  p2x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() - 
-         beam -> horizontalBeamlineAngle() ) ;
-  p2y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() - 
-         beam -> verticalBeamlineAngle() ) ;
-  p2z = -beam -> energy() ;
-  pBeam2.SetXYZ( p2x, p2y, p2z ) ;
-}
-
-//=============================================================================
-// Current value of the smeared beams
-//=============================================================================
-void CollidingBeams::getBeams( Gaudi::XYZVector & pBeam1 , 
-                               Gaudi::XYZVector & pBeam2 ) {
-  // Retrieve beam parameters
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters in TES" ) ;
-
-  double p1x, p1y, p1z, p2x, p2y, p2z ;
-  p1x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() + 
-         beam -> horizontalBeamlineAngle() + 
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p1y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() + 
-         beam -> verticalBeamlineAngle() +
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-
-  p2x = beam -> energy() * 
-    sin( beam -> horizontalCrossingAngle() - 
-         beam -> horizontalBeamlineAngle() + 
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p2y = beam -> energy() * 
-    sin( beam -> verticalCrossingAngle() - 
-         beam -> verticalBeamlineAngle() +
-         m_gaussianDist() * beam -> angleSmear() ) ;
-  p2z = -beam -> energy() ;
-  pBeam2.SetXYZ( p2x, p2y, p2z ) ;
-}
diff --git a/Gen/Generators/src/component/CollidingBeams.h b/Gen/Generators/src/component/CollidingBeams.h
deleted file mode 100755
index 21e01214312d0b27633bb61f205e156f16708862..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/CollidingBeams.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// $Id: CollidingBeams.h,v 1.3 2005-12-31 17:32:01 robbep Exp $
-#ifndef GENERATORS_COLLIDINGBEAMS_H
-#define GENERATORS_COLLIDINGBEAMS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IBeamTool.h"
-
-// Forward declarations
-class IRndmGenSvc ;
-
-/** @class CollidingBeams CollidingBeams.h "CollidingBeams.h"
- *
- *  Tool to compute colliding beams values. Concrete implementation
- *  of a beam tool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class CollidingBeams : public GaudiTool, virtual public IBeamTool {
- public:
-  /// Standard constructor
-  CollidingBeams( const std::string& type, const std::string& name,
-                  const IInterface* parent ) ;
-
-  virtual ~CollidingBeams( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IBeamTool::getMeanBeams
-   */
-  void getMeanBeams( Gaudi::XYZVector & pBeam1 ,
-                     Gaudi::XYZVector & pBeam2 ) const override;
-
-  /** Implements IBeamTool::getBeams
-   *  Compute beam 3-momentum taking into account the horizontal and vertical
-   *  beam angles (given by job options). These angles are Gaussian-smeared
-   *  with an angular smearing equal to (emittance/beta*)^1/2.
-   */
-  void getBeams( Gaudi::XYZVector & pBeam1 ,
-                 Gaudi::XYZVector & pBeam2 ) override;
-
- private:
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  Rndm::Numbers m_gaussianDist ; ///< Gaussian random number generator
-};
-#endif // GENERATORS_COLLIDINGBEAMS_H
diff --git a/Gen/Generators/src/component/EvtGenTool.cpp b/Gen/Generators/src/component/EvtGenTool.cpp
deleted file mode 100755
index 22e39dcd2c5b621afefff4a7fd5f3129374dd713..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/EvtGenTool.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// $Id: EvtGenTool.cpp,v 1.23 2010-05-05 19:38:36 robbep Exp $
-// Header file
-#include "EvtGenTool.h"
-
-
-#include<iostream>
-
-// from Gaudi
-#include "GaudiKernel/System.h"
-#include "GaudiKernel/GaudiException.h"
-
-// from EvtGen
-#include "EvtGen/EvtGen.hh"
-#include "EvtGenBase/EvtParticleFactory.hh"
-#include "EvtGenBase/EvtDecayTable.hh"
-#include "EvtGenBase/EvtDecayBase.hh"
-
-#include "Generators/StreamForGenerator.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : EvtGenTool
-//
-// 2003-10-15 : Alex Shires
-//-----------------------------------------------------------------------------
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( EvtGenTool )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-EvtGenTool::EvtGenTool( const std::string& type,
-                          const std::string& name,
-                          const IInterface* parent )
-  : GaudiTool ( type, name , parent ),
-    m_gen(0),
-    m_init(false) 
-{
-    declareInterface<IEvtGenTool>(this);
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-EvtGenTool::~EvtGenTool( ) { ; }
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode EvtGenTool::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  //MsgStream * msg = new MsgStream( msgSvc() , name() ) ;
-  //StreamForGenerator::getStream() = msg ;
-
-  debug() << "EvtGenTool initialized" << endmsg ;
-  
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode EvtGenTool::finalize() {
-  if ( 0 != m_gen ) { 
-    delete m_gen ;
-    m_gen = 0 ;
-  }
-
-  m_init = false ;
-
-  if ( ! msgLevel( MSG::DEBUG ) ) {
-      debug() << "EvtGenTool finalized" << endmsg ;
-  }
-  
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/EvtGenTool.h b/Gen/Generators/src/component/EvtGenTool.h
deleted file mode 100755
index 185a1aef04d1c613514fef45a6aac4f654d9a549..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/EvtGenTool.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// $Id: EvtGenTool.h,v 1.9 2009-03-16 16:53:26 robbep Exp $
-#ifndef GENERATORS_EVTGENTOOL_H
-#define GENERATORS_EVTGENTOOL_H 1
-
-// Avoid contamination with WINDOWS symbols
-#ifdef WIN32
-#define NOATOM
-#define NOGDI
-#define NOGDICAPMASKS
-#define NOMETAFILE
-#define NOMINMAX
-#define NOMSG
-#define NOOPENFILE
-#define NORASTEROPS
-#define NOSCROLL
-#define NOSOUND
-#define NOSYSMETRICS
-#define NOTEXTMETRIC
-#define NOWH
-#define NOCOMM
-#define NOKANJI
-#define NOCRYPT
-#define NOMCX
-#endif
-
-// Include files
-
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-//interface
-#include "IEvtGenTool.h"
-
-// from EvtGen
-#include "EvtGen/EvtGen.hh"
-
-/** @class EvtGenTool EvtGenTool.h "EvtGenTool.h"
- *
- *  Tool to interface to EvtGen generator.
- *
- *  @author Alex Shires, Patrick Robbe
- *  @date   2011-10-28
- */
-class EvtGenTool : public GaudiTool, virtual public IEvtGenTool {
-public:
-  /// Standard constructor
-  EvtGenTool( const std::string& type, const std::string& name,
-              const IInterface* parent);
-
-  virtual ~EvtGenTool( ) ; ///< Destructor
-
-  /** Initialize method.
-   *  */
-  StatusCode initialize() override;
-
-  /// Finalize method
-  StatusCode finalize() override;
-
-  /// Get the pointer to the EvtGen instance
-  EvtGen* getEvtGen( ) override { return m_gen ; }
-
-  /// Get the pointer to the EvtGen instance
-  void setEvtGen( EvtGen * evtgenptr ) override {  m_gen = evtgenptr ; m_init = true ; }
-
-  /// return the initalised state of EvtGen
-  bool isInit() override { return m_init ; }
-
-private:
-
-    EvtGen * m_gen ; ///< EvtGen engine
-
-    bool m_init ; ///< Initialisation flag
-
-
-};
-
-
-#endif // GENERATORS_EVTGENTOOL_H
diff --git a/Gen/Generators/src/component/FixedLuminosity.cpp b/Gen/Generators/src/component/FixedLuminosity.cpp
deleted file mode 100755
index 735ab94a7be08ccbf09f99aac1562d0a60d9a436..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosity.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// Include files
-
-// local
-#include "FixedLuminosity.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// From Generators
-#include "Generators/GenCounters.h"
-#include "Generators/ICounterLogFile.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FixedLuminosity
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( FixedLuminosity )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FixedLuminosity::FixedLuminosity( const std::string& type,
-                                  const std::string& name,
-                                  const IInterface* parent )
-  : GaudiTool ( type, name , parent ) ,
-    m_xmlLogTool ( 0 ) ,
-    m_numberOfZeroInteraction( 0 ) ,
-    m_nEvents( 0 ) ,
-    m_randSvc( 0 ) {
-    declareInterface< IPileUpTool >( this ) ;
-    declareProperty( "BeamParameters" ,
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-FixedLuminosity::~FixedLuminosity( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode FixedLuminosity::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  m_randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  //  XMl log file
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Compute the number of pile up to generate according to beam parameters
-//=============================================================================
-unsigned int FixedLuminosity::numberOfPileUp( ) {
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters registered" ) ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  unsigned int result = 0 ;
-  while ( 0 == result ) {
-    m_nEvents++ ;
-    key = LHCb::GenCountersFSR::AllEvt;
-    if(genFSR) genFSR->incrementGenCounter(key,1);
-    Rndm::Numbers poissonGenerator( m_randSvc , Rndm::Poisson( beam -> nu() ) ) ;
-    result = (unsigned int) poissonGenerator() ;
-    if ( 0 == result ) {
-      m_numberOfZeroInteraction++ ;
-      key =LHCb::GenCountersFSR::ZeroInt;
-      if(genFSR) genFSR->incrementGenCounter(key, 1);
-    }
-  }
-  return result ;
-}
-
-//=============================================================================
-// Print the specific pile up counters
-//=============================================================================
-void FixedLuminosity::printPileUpCounters( ) {
-  using namespace GenCounters ;
-  printCounter( m_xmlLogTool , "all events (including empty events)", m_nEvents ) ;
-  printCounter( m_xmlLogTool , "events with 0 interaction" ,
-                m_numberOfZeroInteraction ) ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode FixedLuminosity::finalize( ) {
-  release( m_randSvc ) ;
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/FixedLuminosity.h b/Gen/Generators/src/component/FixedLuminosity.h
deleted file mode 100755
index 65f083d3b17483d23cc526e3275d8c6c6b4f8c44..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosity.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// $Id: FixedLuminosity.h,v 1.4 2009-04-07 16:11:21 gcorti Exp $
-#ifndef GENERATORS_FIXEDLUMINOSITY_H
-#define GENERATORS_FIXEDLUMINOSITY_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IPileUpTool.h"
-
-// forward declaration
-class IRndmGenSvc ;
-class ICounterLogFile ;
-
-/** @class FixedLuminosity FixedLuminosity.h "FixedLuminosity.h"
- *
- *  Tool to compute variable number of pile up events
- *  depending on beam parameters
- *
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-class FixedLuminosity : public GaudiTool, virtual public IPileUpTool {
-public:
-  /// Standard constructor
-  FixedLuminosity( const std::string& type, const std::string& name,
-                   const IInterface* parent) ;
-
-  virtual ~FixedLuminosity( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize method
-  StatusCode finalize( ) override;
-
-  /** Implements IPileUpTool::numberOfPileUp
-   *  Returns the number of pile-up interactions in one event. It follows
-   *  a Poisson distribution with
-   *  mean = Luminosity * cross_section / crossing_rate.
-   *  The fixed luminosity is returned in the GenHeader.
-   */
-  unsigned int numberOfPileUp( ) override;
-
-  /// Implements IPileUpTool::printPileUpCounters
-  void printPileUpCounters( ) override;
-
-protected:
-
-private:
-  /// Location where to store FSR counters (set by options)
-  std::string  m_FSRName;
-
-  ICounterLogFile * m_xmlLogTool ; ///< XML File for generator counters
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  int    m_numberOfZeroInteraction ; ///< Counter of empty events
-
-  int    m_nEvents ; ///< Counter of events (including empty events)
-
-  IRndmGenSvc * m_randSvc ; ///< Pointer to random number generator service
-};
-#endif // GENERATORS_FIXEDLUMINOSITY_H
diff --git a/Gen/Generators/src/component/FixedLuminosityForRareProcess.cpp b/Gen/Generators/src/component/FixedLuminosityForRareProcess.cpp
deleted file mode 100755
index 01d8b009baf5a4ccea012b75635948f71c0d6121..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosityForRareProcess.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// $Id: FixedLuminosityForRareProcess.cpp,v 1.3 2009-04-07 16:11:21 gcorti Exp $
-// Include files
-
-// local
-#include "FixedLuminosityForRareProcess.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// From Generators
-#include "Generators/GenCounters.h"
-#include "Generators/ICounterLogFile.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FixedLuminosityForRareProcess
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( FixedLuminosityForRareProcess )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FixedLuminosityForRareProcess::FixedLuminosityForRareProcess( const std::string& type,
-                                  const std::string& name,
-                                  const IInterface* parent )
-  : GaudiTool ( type, name , parent ) ,
-    m_xmlLogTool( 0 ) ,
-    m_nEvents( 0 ) ,
-    m_randSvc( 0 ) {
-    declareInterface< IPileUpTool >( this ) ;
-    declareProperty( "BeamParameters" ,
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-FixedLuminosityForRareProcess::~FixedLuminosityForRareProcess( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode FixedLuminosityForRareProcess::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  m_randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  // XML file for generator statistics
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  info() << "Poisson distribution with fixed luminosity. " << endmsg ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Compute the number of pile up to generate according to beam parameters
-//=============================================================================
-unsigned int FixedLuminosityForRareProcess::numberOfPileUp( ) {
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters registered" ) ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  unsigned int result = 0 ;
-  m_nEvents++ ;
-  key = LHCb::GenCountersFSR::AllEvt;
-  if(genFSR) genFSR->incrementGenCounter(key,1);
-
-  Rndm::Numbers poissonGenerator( m_randSvc , Rndm::Poisson( beam -> nu() ) ) ;
-  result = (unsigned int) ( poissonGenerator() + 1.0 ) ;
-  return result ;
-}
-
-//=============================================================================
-// Print the specific pile up counters
-//=============================================================================
-void FixedLuminosityForRareProcess::printPileUpCounters( ) {
-  using namespace GenCounters ;
-  printCounter( m_xmlLogTool , "all events (including empty events)", m_nEvents ) ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode FixedLuminosityForRareProcess::finalize( ) {
-  release( m_randSvc ) ;
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/FixedLuminosityForRareProcess.h b/Gen/Generators/src/component/FixedLuminosityForRareProcess.h
deleted file mode 100755
index fa249247c876152784c4a52922d31b67f0a8208c..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosityForRareProcess.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id: FixedLuminosityForRareProcess.h,v 1.2 2009-04-07 16:11:21 gcorti Exp $
-#ifndef GENERATORS_FIXEDLUMINOSITYFORRAREPROCESS_H
-#define GENERATORS_FIXEDLUMINOSITYFORRAREPROCESS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IPileUpTool.h"
-
-// forward declaration
-class IRndmGenSvc ;
-class ICounterLogFile ;
-
-/** @class FixedLuminosityForRareProcess FixedLuminosityForRareProcess.h "FixedLuminosityForRareProcess.h"
- *
- *  Tool to compute variable number of pile up events
- *  depending on beam parameters
- *
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-class FixedLuminosityForRareProcess : public GaudiTool, virtual public IPileUpTool {
-public:
-  /// Standard constructor
-  FixedLuminosityForRareProcess( const std::string& type, const std::string& name,
-                   const IInterface* parent) ;
-
-  virtual ~FixedLuminosityForRareProcess( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize method
-  StatusCode finalize( ) override;
-
-  /** Implements IPileUpTool::numberOfPileUp
-   *  Returns the number of pile-up interactions in one event. It follows
-   *  a Poisson distribution with
-   *  mean = Luminosity * cross_section / crossing_rate.
-   *  The fixed luminosity is returned as the currentLuminosity.
-   */
-  unsigned int numberOfPileUp( ) override;
-
-  /// Implements IPileUpTool::printPileUpCounters
-  void printPileUpCounters( ) override;
-
-protected:
-
-private:
-  ICounterLogFile * m_xmlLogTool ; ///< XML File for generator statistics
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  /// Location where to store FSR counters (set by options)
-  std::string  m_FSRName;
-
-  int    m_nEvents ; ///< Counter of events (including empty events)
-
-  IRndmGenSvc * m_randSvc ; ///< Pointer to random number generator service
-};
-#endif // GENERATORS_FIXEDLUMINOSITYFORRAREPROCESS_H
diff --git a/Gen/Generators/src/component/FixedLuminosityForSpillOver.cpp b/Gen/Generators/src/component/FixedLuminosityForSpillOver.cpp
deleted file mode 100644
index 34a0b2b70997ff4509ad1519332aa7f7a5362b33..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosityForSpillOver.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// $Id: FixedLuminosityForSpillOver.cpp,v 1.2 2009-04-07 16:11:21 gcorti Exp $
-// Include files
-
-// local
-#include "FixedLuminosityForSpillOver.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// From Generators
-#include "Generators/GenCounters.h"
-#include "Generators/ICounterLogFile.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FixedLuminosityForSpillOver
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( FixedLuminosityForSpillOver )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FixedLuminosityForSpillOver::FixedLuminosityForSpillOver( const std::string& type,
-							  const std::string& name,
-							  const IInterface* parent )
-  : GaudiTool ( type, name , parent ) ,
-    m_xmlLogTool( 0 ) ,
-    m_numberOfZeroInteraction( 0 ) ,
-    m_nEvents( 0 ) ,
-    m_randSvc( 0 ) {
-    declareInterface< IPileUpTool >( this ) ;
-    declareProperty( "BeamParameters" ,
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-FixedLuminosityForSpillOver::~FixedLuminosityForSpillOver( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode FixedLuminosityForSpillOver::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  m_randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  // Log file XML
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  info() << "Poisson distribution with fixed luminosity. " << endmsg ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Compute the number of pile up to generate according to beam parameters
-//=============================================================================
-unsigned int FixedLuminosityForSpillOver::numberOfPileUp( ) {
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters registered" ) ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  unsigned int result = 0 ;
-  m_nEvents++ ;
-  key = LHCb::GenCountersFSR::AllEvt;
-  if(genFSR) genFSR->incrementGenCounter(key,1);
-
-  Rndm::Numbers poissonGenerator( m_randSvc , Rndm::Poisson( beam -> nu() ) ) ;
-  result = (unsigned int) poissonGenerator() ;
-  if ( 0 == result ) {
-    m_numberOfZeroInteraction++ ;
-    key =LHCb::GenCountersFSR::ZeroInt;
-    if(genFSR) genFSR->incrementGenCounter(key, 1);
-  }
-
-  return result ;
-}
-
-//=============================================================================
-// Print the specific pile up counters
-//=============================================================================
-void FixedLuminosityForSpillOver::printPileUpCounters( ) {
-  using namespace GenCounters ;
-  printCounter( m_xmlLogTool , "all events (including empty events)", m_nEvents ) ;
-  printCounter( m_xmlLogTool , "events with 0 interaction" ,
-                m_numberOfZeroInteraction ) ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode FixedLuminosityForSpillOver::finalize( ) {
-  release( m_randSvc ) ;
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/FixedLuminosityForSpillOver.h b/Gen/Generators/src/component/FixedLuminosityForSpillOver.h
deleted file mode 100644
index 06714ff13b9ccca2c6619b358813ff3997ecde12..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedLuminosityForSpillOver.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// $Id: FixedLuminosityForSpillOver.h,v 1.2 2009-04-07 16:11:21 gcorti Exp $
-#ifndef GENERATORS_FIXEDLUMINOSITYFORSPILLOVER_H
-#define GENERATORS_FIXEDLUMINOSITYFORSPILLOVER_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IPileUpTool.h"
-
-// forward declaration
-class IRndmGenSvc ;
-class ICounterLogFile ;
-
-/** @class FixedLuminosityForSpillOver FixedLuminosityForSpillOver.h "FixedLuminosityForSpillOver.h"
- *
- *  Tool to compute variable number of pile up events
- *  depending on beam parameters.
- *  To be used for spill over generation because it accepts events
- *  with 0 interaction
- *
- *  @author Patrick Robbe
- *  @date   2009-03-30
- */
-class FixedLuminosityForSpillOver : public GaudiTool, virtual public IPileUpTool {
-public:
-  /// Standard constructor
-  FixedLuminosityForSpillOver( const std::string& type, const std::string& name,
-		               const IInterface* parent) ;
-
-  virtual ~FixedLuminosityForSpillOver( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize method
-  StatusCode finalize( ) override;
-
-  /** Implements IPileUpTool::numberOfPileUp
-   *  Returns the number of pile-up interactions in one event. It follows
-   *  a Poisson distribution with
-   *  mean = Luminosity * cross_section / crossing_rate.
-   *  The fixed luminosity is returned as the currentLuminosity.
-   */
-  unsigned int numberOfPileUp( ) override;
-
-  /// Implements IPileUpTool::printPileUpCounters
-  void printPileUpCounters( ) override;
-
-protected:
-
-private:
-  /// Location where to store FSR counters (set by options)
-  std::string  m_FSRName;
-
-  ICounterLogFile * m_xmlLogTool ; ///< Log file in XML
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  int    m_numberOfZeroInteraction ; ///< Counter of empty events
-
-  int    m_nEvents ; ///< Counter of events (including empty events)
-
-  IRndmGenSvc * m_randSvc ; ///< Pointer to random number generator service
-};
-#endif // GENERATORS_FIXEDLUMINOSITYFORSPILLOVER_H
diff --git a/Gen/Generators/src/component/FixedNInteractions.cpp b/Gen/Generators/src/component/FixedNInteractions.cpp
deleted file mode 100755
index 14bc0b4e5e8d0fef5064d7e9cdbe73787559e44f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedNInteractions.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// $Id: FixedNInteractions.cpp,v 1.5 2009-04-07 16:11:21 gcorti Exp $
-// Include files 
-
-// local
-#include "FixedNInteractions.h"
-
-// from Gaudi
-#include "GaudiKernel/SystemOfUnits.h"
-
-// from Event 
-#include "Event/GenHeader.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FixedNInteractions
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( FixedNInteractions )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FixedNInteractions::FixedNInteractions( const std::string& type,
-                                        const std::string& name,
-                                        const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IPileUpTool >( this ) ;
-    declareProperty ( "NInteractions" , m_nInteractions = 1 ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-FixedNInteractions::~FixedNInteractions( ) { }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode FixedNInteractions::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  if ( 1 == m_nInteractions ) 
-    info() << "Single Interaction Mode" << endmsg ;
-  else info() << "Fixed Number of Interactions per Event = : "
-              << m_nInteractions << endmsg ;
-  return sc ;
-}
-
-//=============================================================================
-// Compute the number of pile up to generate according to beam parameters
-//=============================================================================
-unsigned int FixedNInteractions::numberOfPileUp( ) {
-  return m_nInteractions ;
-}
-
-//=============================================================================
-// Print the specific pile up counters
-//=============================================================================
-void FixedNInteractions::printPileUpCounters( ) { }
-
diff --git a/Gen/Generators/src/component/FixedNInteractions.h b/Gen/Generators/src/component/FixedNInteractions.h
deleted file mode 100755
index 20cf8aadb051643599d6d96d83d71881785071c4..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedNInteractions.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id: FixedNInteractions.h,v 1.4 2009-04-07 16:11:21 gcorti Exp $
-#ifndef GENERATORS_FIXEDNINTERACTIONS_H
-#define GENERATORS_FIXEDNINTERACTIONS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-
-#include "Generators/IPileUpTool.h"
-
-/** @class FixedNInteractions FixedNInteractions.h "FixedNInteractions.h"
- *
- *  Tool to generate fixed number of pile-up interactions. Concrete
- *  implementation of IPileUpTool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-class FixedNInteractions : public GaudiTool, virtual public IPileUpTool {
- public:
-  /// Standard constructor
-  FixedNInteractions( const std::string& type,
-                      const std::string& name,
-                      const IInterface* parent);
-
-  virtual ~FixedNInteractions( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Returns a constant number of pile-up interactions.
-   *  Implementation of IPileUpTool::numberOfPileUp.
-   *  Returns a luminosity equal to 0.
-   */
-  unsigned int numberOfPileUp( ) override;
-
-  /// Implementation of IPileUpTool::printPileUpCounters
-  void printPileUpCounters( ) override;
-
- private:
-  /// Number of interactions to generate (set by job options)
-  int m_nInteractions ;
-};
-#endif // GENERATORS_FIXEDNINTERACTIONS_H
diff --git a/Gen/Generators/src/component/FixedTarget.cpp b/Gen/Generators/src/component/FixedTarget.cpp
deleted file mode 100755
index 1eec429904b4bf96ade5860625b1d12d47c58272..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedTarget.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// $Id: FixedTarget.cpp,v 1.4 2007-02-08 17:46:06 gcorti Exp $
-// Include files 
-
-// local
-#include "FixedTarget.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-// from Event
-#include "Event/BeamParameters.h"
-#include "GenEvent/BeamForInitialization.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FixedTarget
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( FixedTarget )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FixedTarget::FixedTarget( const std::string& type, const std::string& name,
-                          const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IBeamTool >( this ) ;
-    declareProperty( "BeamParameters" , 
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-FixedTarget::~FixedTarget( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode FixedTarget::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  
-  sc = m_gaussianDist.initialize( randSvc , Rndm::Gauss( 0. , 1. ) )  ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize Gaussian random generator" , sc ) ;
-  release( randSvc ) ;
-
-  info() << "Collision with fixed target" << endmsg ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Mean value of the beam momentum
-//=============================================================================
-void FixedTarget::getMeanBeams( Gaudi::XYZVector & pBeam1 , 
-                                Gaudi::XYZVector & pBeam2 )
-  const {
-  // Retrieve beam parameters from the static class
-  LHCb::BeamParameters * beam = 
-    BeamForInitialization::getInitialBeamParameters() ;
-  if ( 0 == beam ) 
-    Exception( "No beam parameters for initialization" ) ;
-
-  double p1x, p1y, p1z ;
-  p1x = beam -> energy() * sin( beam -> horizontalCrossingAngle() ) ;
-  p1y = beam -> energy() * sin( beam -> verticalCrossingAngle()   ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-
-  pBeam2.SetXYZ( 0., 0., 0. ) ;
-}
-
-//=============================================================================
-// Current value of the smeared beams
-//=============================================================================
-void FixedTarget::getBeams( Gaudi::XYZVector & pBeam1 , 
-                            Gaudi::XYZVector & pBeam2 ) {
-  // Retrieve beam parameters
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters in TES" ) ;
-
-  double p1x, p1y, p1z ;
-  p1x = beam -> energy() * sin( beam -> horizontalCrossingAngle() + 
-                                m_gaussianDist() * beam -> angleSmear() ) ;
-  p1y = beam -> energy() * sin( beam -> verticalCrossingAngle() + 
-                                m_gaussianDist() * beam -> angleSmear() ) ;
-  p1z = beam -> energy() ;
-  pBeam1.SetXYZ( p1x, p1y, p1z ) ;
-  
-  pBeam2.SetXYZ( 0., 0., 0. ) ;
-}
diff --git a/Gen/Generators/src/component/FixedTarget.h b/Gen/Generators/src/component/FixedTarget.h
deleted file mode 100755
index aa92a7cfa5e809a9f14623e360b9c0c94a6bb687..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FixedTarget.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id: FixedTarget.h,v 1.3 2005-12-31 17:32:01 robbep Exp $
-#ifndef GENERATORS_COLLIDINGBEAMS_H
-#define GENERATORS_COLLIDINGBEAMS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IBeamTool.h"
-
-// Forward declarations
-class IRndmGenSvc ;
-
-/** @class FixedTarget FixedTarget.h "FixedTarget.h"
- *
- *  Tool to compute beam values with only one beam colliding to a fixed
- *  target. Concrete implementation of a IBeamTool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class FixedTarget : public GaudiTool, virtual public IBeamTool {
- public:
-  /// Standard constructor
-  FixedTarget( const std::string& type , const std::string& name,
-               const IInterface* parent ) ;
-
-  virtual ~FixedTarget( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Implements IBeamTool::getMeanBeams. See CollidingBeams::getMeanBeams
-  void getMeanBeams( Gaudi::XYZVector & pBeam1 ,
-                     Gaudi::XYZVector & pBeam2 ) const override;
-
-  /// Implements IBeamTool::getBeams. See CollidingBeams::getBeams
-  void getBeams( Gaudi::XYZVector & pBeam1 ,
-                 Gaudi::XYZVector & pBeam2 ) override;
-
- private:
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  Rndm::Numbers m_gaussianDist ; ///< Gaussian random number generator
-};
-#endif // GENERATORS_FIXEDTARGET_H
diff --git a/Gen/Generators/src/component/FlatSmearVertex.cpp b/Gen/Generators/src/component/FlatSmearVertex.cpp
deleted file mode 100755
index 70d881c802691cf77e22bbce9fa0becbf880b55f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FlatSmearVertex.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// $Id: FlatSmearVertex.cpp,v 1.1.1.1 2009-09-18 16:18:24 gcorti Exp $
-// Include files 
-
-// local
-#include "FlatSmearVertex.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h" 
-#include "GaudiKernel/PhysicalConstants.h"
-#include "GaudiKernel/Vector4DTypes.h"
-#include "GaudiKernel/Transform3DTypes.h"
-
-// from Event
-#include "Event/HepMCEvent.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FlatSmearVertex
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( FlatSmearVertex )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FlatSmearVertex::FlatSmearVertex( const std::string& type,
-                                    const std::string& name,
-                                    const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IVertexSmearingTool >( this ) ;
-    declareProperty( "xVertexMin" , m_xmin = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "xVertexMax" , m_xmax = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "yVertexMin" , m_ymin = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "yVertexMax" , m_ymax = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "zVertexMin" , m_zmin = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "zVertexMax" , m_zmax = 0.0 * Gaudi::Units::mm ) ;
-    declareProperty( "BeamDirection", m_zDir = 0 );
-    declareProperty( "Tilt", m_tilt = false );
-    declareProperty( "TiltAngle", m_tiltAngle = -3.601e-3 );
-    
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-FlatSmearVertex::~FlatSmearVertex( ) { ; }
-
-//=============================================================================
-// Initialize 
-//=============================================================================
-StatusCode FlatSmearVertex::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-  
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  if ( m_xmin > m_xmax ) return Error( "xMin > xMax !" ) ;
-  if ( m_ymin > m_ymax ) return Error( "yMin > yMax !" ) ;  
-  if ( m_zmin > m_zmax ) return Error( "zMin > zMax !" ) ;
-  
-  sc = m_flatDist.initialize( randSvc , Rndm::Flat( 0. , 1. ) ) ;
-  
-  std::string infoMsg = " applying TOF of interaction with ";
-  if ( m_zDir == -1 ) {
-    infoMsg = infoMsg + "negative beam direction";
-  } else if ( m_zDir == 1 ) {
-    infoMsg = infoMsg + "positive beam direction";
-  } else if ( m_zDir == 0 ) {
-    infoMsg = " with TOF of interaction equal to zero ";
-  } else {
-    return Error("BeamDirection can only be set to -1 or 1, or 0 to switch off TOF");
-  }
-
-  info() << "Smearing of interaction point with flat distribution "
-         << " in x, y and z " << endmsg;
-  info() << infoMsg << endmsg;
-  info() << " with " << m_xmin / Gaudi::Units::mm 
-         << " mm <= x <= " << m_xmax / Gaudi::Units::mm << " mm, "
-         << m_ymin / Gaudi::Units::mm << " mm <= y <= " 
-         << m_ymax / Gaudi::Units::mm << " mm and "
-         << m_zmin / Gaudi::Units::mm << " mm <= z <= " 
-         << m_zmax / Gaudi::Units::mm << " mm." << endmsg;
-
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize flat random number generator" ) ;
-
-  release( randSvc ) ;
-  return sc ;
-}
- 
-//=============================================================================
-// Smearing function
-//=============================================================================
-StatusCode FlatSmearVertex::smearVertex( LHCb::HepMCEvent * theEvent ) {
-  double dx , dy , dz , dt ;
-  
-  dx = m_xmin + m_flatDist( ) * ( m_xmax - m_xmin ) ;
-  dy = m_ymin + m_flatDist( ) * ( m_ymax - m_ymin ) ;
-  dz = m_zmin + m_flatDist( ) * ( m_zmax - m_zmin ) ;
-  dt = m_zDir * dz/Gaudi::Units::c_light ;
-
-  Gaudi::LorentzVector dpos( dx , dy , dz , dt ) ;
-  
-  HepMC::GenEvent::vertex_iterator vit ;
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-  for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; 
-        ++vit ) {
-    Gaudi::LorentzVector pos ( (*vit) -> position() ) ;
-    pos += dpos ;
-
-    if (m_tilt) {
-      Gaudi::LorentzVector negT( 0, 0, (fabs(m_zmax-m_zmin)<1e-3 ? -m_zmax : 0), 0 );
-      Gaudi::LorentzVector posT( 0, 0, (fabs(m_zmax-m_zmin)<1e-3 ? +m_zmax : 0), 0 );
-      Gaudi::RotationX rotX( m_zmax==m_zmin ? m_tiltAngle : 0 );
-      pos = pos + negT;
-      pos = rotX(pos);
-      pos = pos + posT;
-    }
-    (*vit) -> set_position( HepMC::FourVector( pos.x() , pos.y() , pos.z() ,
-                                               pos.t() ) ) ;
-  }
-
-  return StatusCode::SUCCESS ;      
-}
-
diff --git a/Gen/Generators/src/component/FlatSmearVertex.h b/Gen/Generators/src/component/FlatSmearVertex.h
deleted file mode 100755
index 09090201d4d2f524f396c2d0e65ffd9630d9ef81..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FlatSmearVertex.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// $Id: FlatSmearVertex.h,v 1.1.1.1 2009-09-18 16:18:24 gcorti Exp $
-#ifndef PARTICLEGUNS_FLATSMEARVERTEX_H
-#define PARTICLEGUNS_FLATSMEARVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IVertexSmearingTool.h"
-
-/** @class FlatSmearVertex FlatSmearVertex.h "FlatSmearVertex.h"
- *
- *  Tool to smear vertex with flat smearing along the x- y- and z-axis.
- *  Concrete implementation of a IVertexSmearingTool.
- *
- *  @author Patrick Robbe
- *  @date   2008-05-18
- */
-class FlatSmearVertex : public GaudiTool, virtual public IVertexSmearingTool {
- public:
-  /// Standard constructor
-  FlatSmearVertex( const std::string& type , const std::string& name,
-                    const IInterface* parent ) ;
-
-  virtual ~FlatSmearVertex( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IVertexSmearingTool::smearVertex.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-  /// Minimum value for the x coordinate of the vertex (set by options)
-  double m_xmin   ;
-
-  /// Minimum value for the y coordinate of the vertex (set by options)
-  double m_ymin   ;
-
-  /// Minimum value for the z coordinate of the vertex (set by options)
-  double m_zmin   ;
-
-  /// Maximum value for the x coordinate of the vertex (set by options)
-  double m_xmax   ;
-
-  /// Maximum value for the y coordinate of the vertex (set by options)
-  double m_ymax   ;
-
-  /// Maximum value for the z coordinate of the vertex (set by options)
-  double m_zmax   ;
-
-  /// Direction of the beam to take into account TOF vs nominal IP8, can have
-  /// only values -1 or 1, or 0 to switch off the TOF and set time of
-  /// interaction to zero (default = 1, as for beam 1)
-  int m_zDir;
-
-  bool m_tilt;
-  double m_tiltAngle;
-
-  Rndm::Numbers m_flatDist ; ///< Flat random number generator
-};
-#endif // PARTICLEGUNS_FLATSMEARVERTEX_H
diff --git a/Gen/Generators/src/component/FlatZSmearVertex.cpp b/Gen/Generators/src/component/FlatZSmearVertex.cpp
deleted file mode 100755
index c77853d56ee089b092de8cb0afe5c1c79baeee8d..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FlatZSmearVertex.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// $Id: FlatZSmearVertex.cpp,v 1.14 2010-05-09 17:05:24 gcorti Exp $
-// Include files 
-
-// local
-#include "FlatZSmearVertex.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h" 
-#include "GaudiKernel/PhysicalConstants.h"
-#include "GaudiKernel/Vector4DTypes.h"
-
-// from Event
-#include "Event/HepMCEvent.h"
-#include "Event/BeamParameters.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : FlatZSmearVertex
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( FlatZSmearVertex )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FlatZSmearVertex::FlatZSmearVertex( const std::string& type,
-                                    const std::string& name,
-                                    const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IVertexSmearingTool >( this ) ;
-
-    declareProperty( "ZMin"   , m_zmin   = -1500. * Gaudi::Units::mm ) ;
-    declareProperty( "ZMax"   , m_zmax   =  1500. * Gaudi::Units::mm ) ;
-
-    declareProperty( "Xcut" , m_xcut = 4. ) ; // times SigmaX 
-    declareProperty( "Ycut" , m_ycut = 4. ) ; // times SigmaY
-
-    declareProperty( "BeamDirection", m_zDir = 1 );
-
-    declareProperty( "BeamParameters" ,
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-FlatZSmearVertex::~FlatZSmearVertex( ) { ; }
-
-//=============================================================================
-// Initialize 
-//=============================================================================
-StatusCode FlatZSmearVertex::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-  
-  IRndmGenSvc * randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  sc = m_gaussDist.initialize( randSvc , Rndm::Gauss( 0. , 1. ) ) ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize gaussian random number generator" ) ;
-  if ( m_zmin > m_zmax ) return Error( "zMin > zMax !" ) ;
-  sc = m_flatDist.initialize( randSvc , Rndm::Flat( m_zmin , m_zmax ) ) ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize flat random number generator" ) ;
-
-  std::string infoMsg = " applying TOF of interaction with ";
-  if ( m_zDir == -1 ) {
-    infoMsg = infoMsg + "negative beam direction";
-  } else if ( m_zDir == 1 ) {
-    infoMsg = infoMsg + "positive beam direction";
-  } else if ( m_zDir == 0 ) {
-    infoMsg = " with TOF of interaction equal to zero ";
-  } else {
-    return Error("BeamDirection can only be set to -1 or 1, or 0 to switch off TOF");
-  }
-
-  info() << "Smearing of interaction point with transverse Gaussian "
-         << " distribution " << endmsg;
-  info() << infoMsg << endmsg;
-  info() << "and flat longitudinal z distribution" << endmsg;
-
-  release( randSvc ) ;
- 
-  return sc ;
-}
- 
-//=============================================================================
-// Smearing function
-//=============================================================================
-StatusCode FlatZSmearVertex::smearVertex( LHCb::HepMCEvent * theEvent ) {
-
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters registered" ) ;
-
-  double dx , dy , dz , dt;
-  
-  dz = m_flatDist( ) ;
-  dt = m_zDir * dz/Gaudi::Units::c_light;
-
-  do { dx = m_gaussDist( ) ; } while ( fabs( dx ) > m_xcut ) ;
-  dx = dx * beam -> sigmaX() * sqrt( 2. ) ;
-  do { dy = m_gaussDist( ) ; } while ( fabs( dy ) > m_ycut ) ;
-  dy = dy * beam -> sigmaY() * sqrt( 2. ) ;
-
-  // take into account mean at z=0 and crossing angle
-  dx = dx/cos( beam -> horizontalCrossingAngle() ) + 
-    beam -> beamSpot().x() + dz*sin( beam -> horizontalCrossingAngle() )*m_zDir;
-  dy = dy/cos( beam -> verticalCrossingAngle() ) + 
-    beam -> beamSpot().y() + dz*sin( beam -> verticalCrossingAngle() )*m_zDir;
-
-  Gaudi::LorentzVector dpos( dx , dy , dz , dt ) ;
-  
-  HepMC::GenEvent::vertex_iterator vit ;
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-  for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; 
-        ++vit ) {
-    Gaudi::LorentzVector pos ( (*vit) -> position() ) ;
-    pos += dpos ;
-    (*vit) -> set_position( HepMC::FourVector( pos.x() , pos.y() , 
-                                               pos.z() , pos.t() ) ) ;
-  }
-
-  return StatusCode::SUCCESS ;      
-}
-
diff --git a/Gen/Generators/src/component/FlatZSmearVertex.h b/Gen/Generators/src/component/FlatZSmearVertex.h
deleted file mode 100755
index ba0e25d6139233a45505b55c948b58dffc4b4f64..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/FlatZSmearVertex.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id: FlatZSmearVertex.h,v 1.5 2010-05-09 17:05:30 gcorti Exp $
-#ifndef GENERATORS_FLATZSMEARVERTEX_H
-#define GENERATORS_FLATZSMEARVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IVertexSmearingTool.h"
-
-/** @class FlatZSmearVertex FlatZSmearVertex.h "FlatZSmearVertex.h"
- *
- *  Tool to smear vertex with flat smearing along the z-axis and Gaussian
- *  smearing for the other axis (as in BeamSpotSmearVertex). Concrete
- *  implementation of a IVertexSmearingTool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-24
- */
-class FlatZSmearVertex : public GaudiTool, virtual public IVertexSmearingTool {
- public:
-  /// Standard constructor
-  FlatZSmearVertex( const std::string& type , const std::string& name,
-                    const IInterface* parent ) ;
-
-  virtual ~FlatZSmearVertex( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IVertexSmearingTool::smearVertex.
-   *  Does the same than BeamSpotSmearVertex::smearVertex for the x and y
-   *  direction but generates flat distribution for the z-coordinate of
-   *  the primary vertex.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  /// Number of sigma above which to cut for x-axis smearing (set by options)
-  double m_xcut   ;
-
-  /// Number of sigma above which to cut for y-axis smearing (set by options)
-  double m_ycut   ;
-
-  /// Minimum value for the z coordinate of the vertex (set by options)
-  double m_zmin   ;
-
-  /// Maximum value for the z coordinate of the vertex (set by options)
-  double m_zmax   ;
-
-  /// Direction of the beam to take into account TOF vs nominal IP8, can have
-  /// only values -1 or 1, or 0 to switch off the TOF and set time of
-  /// interaction to zero (default = 1, as for beam 1)
-  int m_zDir;
-
-  Rndm::Numbers m_gaussDist ; ///< Gaussian random number generator
-
-  Rndm::Numbers m_flatDist ; ///< Flat random number generator
-};
-#endif // GENERATORS_FLATZSMEARVERTEX_H
diff --git a/Gen/Generators/src/component/Generation.cpp b/Gen/Generators/src/component/Generation.cpp
deleted file mode 100755
index 26d541d53ecb10faa28d3e6c765bd3818af1e0fe..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Generation.cpp
+++ /dev/null
@@ -1,670 +0,0 @@
-// $Id: Generation.cpp,v 1.33 2009-06-15 17:02:35 gcorti Exp $
-// Include files 
-
-// from Gaudi
-#include "GaudiKernel/RndmGenerators.h"
-#include "GaudiKernel/SystemOfUnits.h"
-
-// from Event
-#include "Event/GenHeader.h"
-#include "Event/GenCollision.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-#include "Event/CrossSectionsFSR.h"
-
-// from LHCb
-#include "Kernel/ParticleID.h"
-#include "MCInterfaces/IFullGenEventCutTool.h"
-#include "MCInterfaces/IDecayTool.h" 
-
-// from Generators
-#include "Generators/ISampleGenerationTool.h"
-#include "Generators/IPileUpTool.h"
-#include "Generators/IVertexSmearingTool.h"
-#include "Generators/ICounterLogFile.h"
-#include "Generators/GenCounters.h"
-#include "GenEvent/HepMCUtils.h"
-
-// Gaudi Common Flat Random Number generator
-#include "Generators/RandomForGenerator.h"
-
-// local
-#include "Generation.h"
-
-#include <iostream>
-#include <stdlib.h>     /* getenv */
-#include "TSystem.h"
-#include "TUnixSystem.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : Generation
-//
-// 2005-08-11 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-
-DECLARE_COMPONENT( Generation )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-Generation::Generation( const std::string& name,
-                        ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator ) ,
-    m_fileRecordSvc        ( 0 ) ,
-    m_pileUpTool           ( 0 ) ,
-    m_decayTool            ( 0 ) ,
-    m_xmlLogTool           ( 0 ) ,
-    m_sampleGenerationTool ( 0 ) ,
-    m_vertexSmearingTool   ( 0 ) ,
-    m_fullGenEventCutTool  ( 0 ) ,
-    m_nEvents              ( 0 ) , 
-    m_nAcceptedEvents      ( 0 ) ,
-    m_nInteractions        ( 0 ) , 
-    m_nAcceptedInteractions( 0 ) ,
-    m_nBeforeFullEvent     ( 0 ) ,
-    m_nAfterFullEvent      ( 0 ) ,
-    m_genFSR               ( 0 ) {  
-
-    // Generation Method
-    declareProperty ( "SampleGenerationTool" , 
-                      m_sampleGenerationToolName = "MinimumBias" ) ;
-    declareProperty ( "EventType"          , m_eventType = 30000000 ) ;
-
-    // Location of the output of the generation
-    declareProperty ( "HepMCEventLocation" , m_hepMCEventLocation = 
-                      LHCb::HepMCEventLocation::Default ) ;
-    declareProperty ( "GenHeaderLocation"  , m_genHeaderLocation = 
-                      LHCb::GenHeaderLocation::Default ) ;
-    declareProperty ( "GenCollisionLocation" , m_genCollisionLocation = 
-                      LHCb::GenCollisionLocation::Default ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-
-    // Tool name to generate the event
-    declareProperty( "PileUpTool" , m_pileUpToolName = "FixedLuminosity" ) ;
-    // Tool name to decay particles in the event
-    declareProperty( "DecayTool"  , m_decayToolName = "EvtGenDecay" ) ;
-    // Tool name to smear vertex
-    declareProperty( "VertexSmearingTool" , 
-                     m_vertexSmearingToolName = "BeamSpotSmearVertex" ) ;
-    // Tool name to cut on full event
-    declareProperty( "FullGenEventCutTool" , 
-                     m_fullGenEventCutToolName = "" ) ;
-    // Flag to attach all pile up events to the same PV
-    declareProperty( "CommonVertex" , m_commonVertex = false ) ;
-
-    // Reset counters
-    m_intC.assign( 0 ) ;
-    m_intCAccepted.assign( 0 ) ;
-    // setup counter names
-    m_intCName[ Oneb ] = "generated interactions with >= 1b" ;    
-    m_intCName[ Threeb ] = "generated interactions with >= 3b" ;
-    m_intCName[ PromptB ] = "generated interactions with 1 prompt B" ;
-    m_intCName[ Onec ] = "generated interactions with >= 1c" ;
-    m_intCName[ Threec ] = "generated interactions with >= 3c" ;
-    m_intCName[ PromptC ] = "generated interactions with >= prompt C" ;
-    m_intCName[ bAndc ] = "generated interactions with b and c" ;
-
-    m_intCAcceptedName[ Oneb ] = "accepted interactions with >= 1b" ;    
-    m_intCAcceptedName[ Threeb ] = "accepted interactions with >= 3b" ;
-    m_intCAcceptedName[ PromptB ] = "accepted interactions with 1 prompt B" ;
-    m_intCAcceptedName[ Onec ] = "accepted interactions with >= 1c" ;
-    m_intCAcceptedName[ Threec ] = "accepted interactions with >= 3c" ;
-    m_intCAcceptedName[ PromptC ] = "accepted interactions with >= prompt C" ;
-    m_intCAcceptedName[ bAndc ] = "accepted interactions with b and c" ;
-
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-Generation::~Generation() {}
-
-//=============================================================================
-// Initialisation. Check parameters
-//=============================================================================
-StatusCode Generation::initialize() {
-  StatusCode sc = GaudiAlgorithm::initialize( ) ; // Initialize base class
-  if ( sc.isFailure() ) return sc ;
-  debug() << "==> Initialise" << endmsg ;
-
-  // Initialization of the Common Flat Random generator if not already done
-  // This generator must be used by all external MC Generator
-  if ( ! ( RandomForGenerator::getNumbers() ) ) {
-    sc = RandomForGenerator::getNumbers().initialize( randSvc( ) , 
-                                                      Rndm::Flat( 0 , 1 ) ) ;
-    if ( ! sc.isSuccess( ) )
-      return Error( "Could not initialize Rndm::Flat" , sc ) ;
-  }
-
-  // Retrieve pile up tool
-  if ( "" == m_pileUpToolName ) {
-    info() << "No Pile Up Tool is defined. Will generate no pile-up " 
-           << endmsg ;
-    info() << "and set luminosity in header to 2e32" << endmsg ;
-  } else m_pileUpTool = tool< IPileUpTool >( m_pileUpToolName , this ) ;
-
-  // Retrieve decay tool
-  if ( "" != m_decayToolName ) m_decayTool = 
-    tool< IDecayTool >( m_decayToolName ) ;
-
-  // Retrieve xml log file tool for generator statistics
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  // Retrieve generation method tool
-  if ( "" == m_sampleGenerationToolName ) 
-    return Error( "No Sample Generation Tool is defined. This is mandatory" ) ;
-  m_sampleGenerationTool = 
-    tool< ISampleGenerationTool >( m_sampleGenerationToolName , this ) ;
-  
-  // Retrieve vertex smearing tool
-  if ( "" == m_vertexSmearingToolName ) {
-    info() << "No vertex smearing tool is defined. Will not smear anything." 
-           << endmsg ;
-  } else {
-    m_vertexSmearingTool = 
-      tool< IVertexSmearingTool >( m_vertexSmearingToolName , this ) ;
-  }
-  
-  // Retrieve full gen event cut tool
-  if ( "" != m_fullGenEventCutToolName ) m_fullGenEventCutTool =
-    tool< IFullGenEventCutTool >( m_fullGenEventCutToolName , this ) ;
-
-  // Message relative to event type
-  always()
-    << "=================================================================="
-    << endmsg;
-  always()
-    << "Requested to generate EventType " << m_eventType << endmsg;
-  always()
-    << "=================================================================="
-    << endmsg;
-
-  if (m_FSRName != "") {
-    // get the File Records service
-    m_fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-
-    // create a new FSR and append to TDS
-    m_genFSR = new LHCb::GenFSR();
-
-    // Now either create the info in the TES or add it to the existing one
-    put(m_fileRecordSvc, m_genFSR, m_FSRName, false);
-
-    m_genFSR->initializeInfos();
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode Generation::execute() {
-
-  debug() << "Processing event type " << m_eventType << endmsg ;
-  StatusCode sc = StatusCode::SUCCESS ;
-  setFilterPassed( true ) ;
-
-  // Get the header and update the information
-  LHCb::GenHeader* theGenHeader = get<LHCb::GenHeader> ( m_genHeaderLocation );
-  if( !theGenHeader->evType() ){
-    theGenHeader -> setEvType( m_eventType );  
-  }
-
-  if(m_genFSR && m_genFSR->getSimulationInfo("evtType", 0) == 0)
-  {
-    std::string decFiles = "";
-    int evtType = 0;
-    std::string path = gSystem->Getenv("DECFILESROOT");
-    std::string decFiles_file = "";
-   
-    if(path!=NULL)
-    {
-      decFiles_file = path;
-    
-      for(int i=decFiles_file.length()-1; i>= 0; i--)
-      {
-        char stop_char = '/';
-        char ichar = decFiles_file[i];
-        if(ichar!=stop_char)
-          decFiles += ichar;
-        else
-          break; 
-      }
-
-      std::reverse(decFiles.begin(), decFiles.end());      
-    }
-
-    evtType = m_eventType;
-
-    m_genFSR->addSimulationInfo("evtType", evtType);
-    m_genFSR->addSimulationInfo("generationMethod",m_sampleGenerationTool->name());
-    m_genFSR->addSimulationInfo("decFiles", decFiles);
-    m_genFSR->incrementNJobs();
-  }
-
-  unsigned int  nPileUp( 0 ) ;
-  
-  LHCb::HepMCEvents::iterator itEvents ;
-
-  // Create temporary containers for this event
-  LHCb::HepMCEvents* theEvents = new LHCb::HepMCEvents( );
-  LHCb::GenCollisions* theCollisions = new LHCb::GenCollisions( );
-
-  interactionCounter theIntCounter ;
-
-  // variables to store counters in FSR                                                              
-  int key = 0;  
-  std::string name = " ";
-
-  // Generate a set of interaction until a good one is found
-  bool goodEvent = false ;
-  while ( ! goodEvent ) {
-    theEvents->clear() ;
-    theCollisions->clear() ;
-    
-    // Compute the number of pile-up interactions to generate 
-    if ( 0 != m_pileUpTool ) 
-      nPileUp = m_pileUpTool -> numberOfPileUp( ) ;
-    else 
-      // default set to 1 pile and 2.10^32 luminosity
-      nPileUp = 1 ;
-
-    // generate a set of Pile up interactions according to the requested type
-    // of event
-    if ( 0 < nPileUp ) 
-      goodEvent = m_sampleGenerationTool -> generate( nPileUp, theEvents, 
-                                                      theCollisions );
-    else { 
-      goodEvent = true ;
-      setFilterPassed( false ) ;
-    }
-    
-    // increase event and interactions counters
-    ++m_nEvents ;    m_nInteractions += nPileUp ;
-
-    // increase the generated events counter in the FSR                                                                                                          
-    name = "EvtGenerated";
-    key = LHCb::GenCountersFSR::CounterKeyToType(name);
-    if(m_genFSR) m_genFSR->incrementGenCounter(key,1);
-    // increase the generated interactions counter in the FSR                                                                                                    
-    name = "IntGenerated";
-    key = LHCb::GenCountersFSR::CounterKeyToType(name);    
-    if(m_genFSR) m_genFSR->incrementGenCounter(key,nPileUp);
-
-    // Update interaction counters
-    if ( 0 < nPileUp ) { 
-      theIntCounter.assign( 0 ) ;
-      for ( itEvents = theEvents->begin() ; itEvents != theEvents->end() ; 
-            ++itEvents ) updateInteractionCounters( theIntCounter , *itEvents ) ;
-    
-      // Increse the generated interactions counters in FSR                                                                                                      
-      if(m_genFSR) updateFSRCounters(theIntCounter, m_genFSR, "Gen");
-
-      GenCounters::AddTo( m_intC , theIntCounter ) ;
-
-      // Decay the event if it is a good event
-      if ( goodEvent ) {
-        unsigned short iPile( 0 ) ;
-        for ( itEvents = theEvents->begin() ; itEvents != theEvents->end() ;
-              ++itEvents ) {
-          if ( 0 != m_decayTool ) {
-            sc = decayEvent( *itEvents ) ;
-            if ( ! sc.isSuccess() ) goodEvent = false ;
-          }
-          (*itEvents) -> pGenEvt() -> set_event_number( ++iPile ) ;
-          if(m_vertexSmearingTool){
-            if ( ( ! ( m_commonVertex ) ) || ( 1 == iPile ) )
-                sc = m_vertexSmearingTool -> smearVertex( *itEvents ) ;
-            if ( ! sc.isSuccess() ) return sc ;
-          }
-        }
-      }
-
-      if ( ( m_commonVertex ) && ( 1 < nPileUp ) ) {
-        HepMC::FourVector commonV = 
-          ((*(theEvents->begin())) ->pGenEvt() -> beam_particles().first) -> end_vertex() -> position() ;
-        for ( itEvents = (theEvents->begin()+1) ; itEvents != theEvents -> end() ;
-              ++itEvents ) {
-          HepMC::GenEvent::vertex_iterator vit ;
-          HepMC::GenEvent * pEvt = (*itEvents) -> pGenEvt() ;
-          for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; 
-                ++vit ) {
-            HepMC::FourVector pos = (*vit) -> position() ;
-            (*vit) -> set_position( HepMC::FourVector( pos.x() + commonV.x() , 
-                                                       pos.y() + commonV.y() , 
-                                                       pos.z() + commonV.z() , 
-                                                       pos.t() + commonV.t() ) ) ;
-          }
-        } 
-      }
-      
-
-      // Apply generator level cut on full event
-      if ( m_fullGenEventCutTool ) {
-        if ( goodEvent ) {
-          ++m_nBeforeFullEvent ;
-          // increase the counter of events before the full event generator level cut in the FSR                                                                 
-          name = "BeforeFullEvt";
-          key = LHCb::GenCountersFSR::CounterKeyToType(name);          
-          if(m_genFSR) m_genFSR->incrementGenCounter(key,1);
-
-          goodEvent = m_fullGenEventCutTool -> studyFullEvent( theEvents , 
-                                                             theCollisions );
-          if ( goodEvent ) {
-            ++m_nAfterFullEvent ;
-            // increase the counter of events after the full event generator level cut in the FSR                                                                
-            name = "AfterFullEvt";
-            key = LHCb::GenCountersFSR::CounterKeyToType(name);
-            if(m_genFSR) m_genFSR->incrementGenCounter(key,1);            
-          }
-        }
-      }
-    }
-  }  
-
-  ++m_nAcceptedEvents ;
-  m_nAcceptedInteractions += nPileUp ;
-  
-  // increase the generated events counter in the FSR                                                                                                            
-  name = "EvtAccepted";
-  key = LHCb::GenCountersFSR::CounterKeyToType(name);
-  if(m_genFSR) m_genFSR->incrementGenCounter(key,1);
-
-  // increase the generated interactions counter in the FSR                                                                                                      
-  name = "IntAccepted";
-  key = LHCb::GenCountersFSR::CounterKeyToType(name);  
-  if(m_genFSR) m_genFSR->incrementGenCounter(key,nPileUp);
-
-  LHCb::HepMCEvents* eventsInTES( 0 )  ;
-  LHCb::GenCollisions* collisionsInTES( 0 ) ;
-  if ( 0 < nPileUp ) {
-    GenCounters::AddTo( m_intCAccepted , theIntCounter ) ;
-
-    // Increse the accepted interactions counters in FSR                                                                                                         
-    if(m_genFSR) updateFSRCounters(theIntCounter, m_genFSR, "Acc");
-
-    // Now either create the info in the TES or add it to the existing one
-    eventsInTES = 
-      getOrCreate<LHCb::HepMCEvents,LHCb::HepMCEvents>( m_hepMCEventLocation );
-
-    collisionsInTES = 
-      getOrCreate<LHCb::GenCollisions,LHCb::GenCollisions>( m_genCollisionLocation );
-  }
-    
-  // Copy the HepMCevents and Collisions from the temporary containers to 
-  // those in TES and update the header information
-
-  // Check that number of temporary HepMCEvents is the same as GenCollisions
-  if( theEvents->size() != theCollisions->size() ) {
-    return Error("Number of HepMCEvents and GenCollisions do not match" );
-  }
-
-  itEvents = theEvents->begin();
-  if ( 0 < nPileUp ) {
-    for( LHCb::GenCollisions::const_iterator it = theCollisions->begin();
-         theCollisions->end() != it; ++it ) {
-
-      // GenFSR
-      if(m_genFSR && m_genFSR->getSimulationInfo("hardGenerator", "") == "")
-        m_genFSR->addSimulationInfo("hardGenerator",(*itEvents)->generatorName());
-
-      // HepMCEvent
-      LHCb::HepMCEvent* theHepMCEvent = new LHCb::HepMCEvent();
-      theHepMCEvent->setGeneratorName( (*itEvents)->generatorName() );
-      (*theHepMCEvent->pGenEvt()) = (*(*itEvents)->pGenEvt());
-      eventsInTES->insert( theHepMCEvent );
-      ++itEvents;
-      
-      // GenCollision
-      LHCb::GenCollision* theGenCollision = new LHCb::GenCollision();
-      theGenCollision->setIsSignal( (*it)->isSignal() );
-      theGenCollision->setProcessType( (*it)->processType() );
-      theGenCollision->setSHat( (*it)->sHat() );
-      theGenCollision->setTHat( (*it)->tHat() );
-      theGenCollision->setUHat( (*it)->uHat() );
-      theGenCollision->setPtHat( (*it)->ptHat() );
-      theGenCollision->setX1Bjorken( (*it)->x1Bjorken() );
-      theGenCollision->setX2Bjorken( (*it)->x2Bjorken() );
-      theGenCollision->setEvent( theHepMCEvent );
-      collisionsInTES->insert( theGenCollision );
-      
-      // GenHeader
-      theGenHeader->addToCollisions( theGenCollision );
-      
-    }
-  }
-
-  // Clear and delete the temporary containers
-  theEvents->clear();
-  theCollisions->clear();
-  delete(theEvents);
-  delete(theCollisions);
-
-  return sc ;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode Generation::finalize() {
-  using namespace GenCounters ;
-  debug( ) << "==> Finalize" << endmsg ;
-  // Add the event type number to the log file
-  m_xmlLogTool -> addEventType( m_eventType ) ;
-  
-  // Print the various counters
-  if ( 0 != m_pileUpTool ) { m_pileUpTool -> printPileUpCounters( ) ; }
-
-  printCounter( m_xmlLogTool , "generated events" , m_nEvents ) ;
-  printCounter( m_xmlLogTool , "generated interactions" , m_nInteractions ) ;
-  
-  for ( unsigned int i = 0 ; i < m_intC.size() ; ++i )
-    printCounter( m_xmlLogTool , m_intCName[ i ] , m_intC[ i ] ) ;
-  
-  printCounter( m_xmlLogTool , "accepted events" , m_nAcceptedEvents ) ;
-  printCounter( m_xmlLogTool , "interactions in accepted events" , 
-                m_nAcceptedInteractions ) ;
-  
-  for ( unsigned int j = 0 ; j < m_intCAccepted.size() ; ++j ) 
-    printCounter( m_xmlLogTool , m_intCAcceptedName[ j ] , 
-                  m_intCAccepted[ j ] ) ;
-
-  printEfficiency( m_xmlLogTool , "full event cut" , m_nAfterFullEvent , 
-                   m_nBeforeFullEvent ) ;
-
-  m_sampleGenerationTool -> printCounters() ;
-
-  // check if the FSR can be retrieved from the TS                                                                                                               
-  if(m_FSRName != ""){
-    LHCb::GenFSR* readFSR = getIfExists<LHCb::GenFSR>(m_fileRecordSvc, m_FSRName);
-    if(readFSR!=NULL)    // print the FSR just retrieved from TS
-      always() << "READ FSR: " << *readFSR << endmsg;
-  }
-
-  if ( 0 != m_pileUpTool ) release( m_pileUpTool ) ;
-  if ( 0 != m_decayTool ) release( m_decayTool ) ;
-  if ( 0 != m_sampleGenerationTool ) release( m_sampleGenerationTool ) ;
-  if ( 0 != m_vertexSmearingTool ) release( m_vertexSmearingTool ) ;
-  if ( 0 != m_fullGenEventCutTool ) release( m_fullGenEventCutTool ) ;
-  
-  return GaudiAlgorithm::finalize( ) ; // Finalize base class
-}
-
-//=============================================================================
-// Decay in the event all particles which have been left stable by the
-// production generator
-//=============================================================================
-StatusCode Generation::decayEvent( LHCb::HepMCEvent * theEvent ) {
-  using namespace LHCb;
-  m_decayTool -> disableFlip() ;
-  StatusCode sc ;
-  
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-
-  // We must use particles_begin to obtain an ordered iterator of GenParticles
-  // according to the barcode: this allows to reproduce events !
-  HepMCUtils::ParticleSet pSet( pEvt -> particles_begin() , 
-                                pEvt -> particles_end() ) ;
-
-  HepMCUtils::ParticleSet::iterator itp ;
-
-  for ( itp = pSet.begin() ; itp != pSet.end() ; ++itp ) {
-    
-    HepMC::GenParticle * thePart = (*itp) ;
-    unsigned int status = thePart -> status() ;
-    
-    if ( ( HepMCEvent::StableInProdGen  == status ) || 
-         ( ( HepMCEvent::DecayedByDecayGenAndProducedByProdGen == status )
-           && ( 0 == thePart -> end_vertex() ) ) ) {
-      
-      if ( m_decayTool -> isKnownToDecayTool( thePart -> pdg_id() ) ) {
-        
-        if ( HepMCEvent::StableInProdGen == status ) 
-          thePart -> 
-            set_status( HepMCEvent::DecayedByDecayGenAndProducedByProdGen ) ;
-        else thePart -> set_status( HepMCEvent::DecayedByDecayGen ) ;
-        
-        sc = m_decayTool -> generateDecay( thePart ) ;
-        if ( ! sc.isSuccess() ) return sc ;
-      }
-    } 
-  }  
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Interaction counters
-//=============================================================================
-void Generation::updateInteractionCounters( interactionCounter & theCounter ,
-                                            const LHCb::HepMCEvent * evt ) 
-{
-  const HepMC::GenEvent * theEvent = evt -> pGenEvt() ;
-  unsigned int bQuark( 0 ) , bHadron( 0 ) , cQuark( 0 ) , cHadron( 0 ) ;
-  int pdgId ;
-
-  HepMC::GenEvent::particle_const_iterator iter ;
-  for ( iter = theEvent -> particles_begin() ; 
-        theEvent -> particles_end() != iter ; ++iter ) {
-    if ( ( (*iter) -> status() == LHCb::HepMCEvent::DocumentationParticle ) ||
-         ( (*iter) -> status() == LHCb::HepMCEvent::DecayedByDecayGen ) ||
-         ( (*iter) -> status() == LHCb::HepMCEvent::StableInDecayGen ) ) 
-      continue ;
-    pdgId = abs( (*iter) -> pdg_id() ) ;
-    LHCb::ParticleID thePid( pdgId ) ;
-
-    if ( 5 == pdgId ) { 
-      if ( 0 != (*iter) -> production_vertex() ) {
-        if ( 1 != (*iter) -> production_vertex() -> particles_in_size() ) {
-           bool containB = false;
-           for (HepMC::GenVertex::particles_in_const_iterator par = (*iter) -> production_vertex() -> particles_in_const_begin();
-                par != (*iter) -> production_vertex() -> particles_in_const_end() ; par++) {
-             if (5==abs((*par)->pdg_id()))
-               containB = true;
-           }
-           if (!containB) ++bQuark ;
-        } else {
-          const HepMC::GenParticle * par = 
-            *( (*iter) -> production_vertex() -> particles_in_const_begin() ) ;
-          if ( ( par -> status() == 
-                 LHCb::HepMCEvent::DocumentationParticle ) ||
-               ( par -> pdg_id() != (*iter) -> pdg_id() ) ) { 
-            ++bQuark ;
-          }
-        }
-      }
-    }
-    else if( 4 == pdgId ) {
-      if ( 0 != (*iter) -> production_vertex() ) {
-        if ( 1 != (*iter) -> production_vertex() -> particles_in_size() ) {
-          bool containC = false;
-          for (HepMC::GenVertex::particles_in_const_iterator par = (*iter) -> production_vertex() -> particles_in_const_begin();
-               par != (*iter) -> production_vertex() -> particles_in_const_end() ; par++) {
-            if (4==abs((*par)->pdg_id()))
-              containC = true;
-          }
-          if (!containC) ++cQuark ;
-        } else {
-          const HepMC::GenParticle * par =
-            *( (*iter) -> production_vertex() -> particles_in_const_begin() ) ;
-          if ( ( par -> status() ==
-                 LHCb::HepMCEvent::DocumentationParticle ) ||
-               ( par -> pdg_id() != (*iter) -> pdg_id() ) ) {
-            ++cQuark ;
-          }
-        }
-      }
-    }
-    else {
-      if ( thePid.hasBottom() ) {
-        // Count B from initial proton as a quark
-        if ( 0 != (*iter) -> production_vertex() ) {
-          if ( 0 != (*iter) -> production_vertex() -> particles_in_size() ) {
-            const HepMC::GenParticle * par = 
-              *( (*iter)-> production_vertex()-> particles_in_const_begin() ) ;
-            if ( 0 != par -> production_vertex() ) {
-              if ( 0 == par -> production_vertex() -> particles_in_size() ) {
-                ++bQuark ;
-              }
-            } 
-            else {
-              ++bQuark ;
-            }
-          }
-        }
-        ++bHadron ;
-      } else if ( thePid.hasCharm() ) {
-        // Count D from initial proton as a quark
-        if ( 0 != (*iter) -> production_vertex() ) {
-          if ( 0 != (*iter) -> production_vertex() -> particles_in_size() ) {
-            const HepMC::GenParticle * par = 
-              *( (*iter)-> production_vertex()-> particles_in_const_begin() ) ;
-            if ( 0 != par -> production_vertex() ) {
-              if ( 0 == par -> production_vertex() -> particles_in_size() ) 
-                ++cQuark ;
-            } else ++cQuark ;
-          }
-        }
-        ++cHadron ;
-      }
-    }
-  }
-
-  if ( bQuark >= 1 ) { 
-    ++theCounter[ Oneb ] ;
-    if ( bQuark >= 3 ) ++theCounter[ Threeb ] ;
-  }
-  if ( cQuark >= 1 ) {
-    ++theCounter[ Onec ] ;
-    if ( cQuark >= 3 ) ++theCounter[ Threec ] ;
-    if ( bQuark >= 1 ) ++theCounter[ bAndc ] ;
-  }
-  if ( ( 0 == bQuark ) && ( bHadron > 0 ) ) ++theCounter[ PromptB ] ;
-  if ( ( 0 == cQuark ) && ( 0 == bHadron ) && ( cHadron > 0 ) ) 
-    ++theCounter[ PromptC ];
-}
-
-
-//=============================================================================
-// Interaction counters in FSR                                              
-//=============================================================================                   
-
-void Generation::updateFSRCounters( interactionCounter & theCounter,
-                                    LHCb::GenFSR* m_genFSR,
-                                    const std::string option)
-{
-  int key = 0; 
-  longlong count = 0;
-  std::string name[7]= {"Oneb","Threeb","PromptB","Onec","Threec","PromptC","bAndc"};  
-  std::string cname = "";
-
-  for(int i=0; i<7; i++)
-  {
-    cname = name[i]+option;
-    key = LHCb::GenCountersFSR::CounterKeyToType(cname);
-    count = theCounter[i];
-    m_genFSR->incrementGenCounter(key,count); 
-  } 
-}
diff --git a/Gen/Generators/src/component/Generation.h b/Gen/Generators/src/component/Generation.h
deleted file mode 100755
index 2a01c2e1b5fd788183dbe03c521987f1eeaff84b..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Generation.h
+++ /dev/null
@@ -1,187 +0,0 @@
-// $Id: Generation.h,v 1.9 2007-07-03 16:31:36 gcorti Exp $
-#ifndef GENERATORS_GENERATION_H
-#define GENERATORS_GENERATION_H 1
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include <boost/array.hpp>
-
-#include "Event/GenFSR.h"
-
-// Forward declarations
-class ISampleGenerationTool ;
-class IPileUpTool ;
-class IDecayTool ;
-class IVertexSmearingTool ;
-class IFullGenEventCutTool ;
-class ICounterLogFile ;
-
-namespace HepMC {
-  class GenParticle ;
-}
-
-namespace LHCb {
-  class HepMCEvent;
-}
-
-/** @class Generation Generation.h "Generation.h"
- *
- *  Main algorithm to generate Monte Carlo events.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-11
- */
-class Generation : public GaudiAlgorithm {
- public:
-  /// Standard constructor
-  Generation( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~Generation( ); ///< Destructor
-
-  /** Algorithm initialization.
-   *  -# Initializes the common Gaudi random number generator used in all
-   *     generators,
-   *  -# Retrieve Pile-up tool, sample generation tool, decay tool,
-   *     vertex smearing tool and full event cut tool used in the generation
-   *     of events.
-   */
-  StatusCode initialize() override;
-
-  /** Algorithm execution.
-   *  Repeat the following sequence until a good set of interactions is
-   *  generated.
-   *  -# Compute the number of interactions to generate in the event, using
-   *     the IPileUpTool.
-   *  -# Generate this number of interactions using the IProductionTool.
-   *     The IProductionTool indicates if a good event has been generated
-   *     (containing for example a B hadron).
-   *  -# Decay with the IDecayTool all particles in the event, if this is
-   *     a good event.
-   *  -# Apply the full event generator level cut (using IFullEventGenCutTool)
-   *     and accept or reject the event.
-   *  -# Store in event store the accepted event.
-   */
-  StatusCode execute   () override;
-
-  /** Algorithm finalization.
-   *  Print generation counters.
-   */
-  StatusCode finalize  () override;
-
-protected:
-  /// Decay the event with the IDecayTool.
-  StatusCode decayEvent( LHCb::HepMCEvent * theEvent ) ;
-
-private:
-  int          m_eventType ; ///< Event type (set by options)
-
-  /// Location where to store generator events (set by options)
-  std::string  m_hepMCEventLocation ;
-
-  /// Location where to store the Header of the events (set by options)
-  std::string  m_genHeaderLocation ;
-
-  /// Location where to store HardInfo (set by options)
-  std::string  m_genCollisionLocation ;
-
-  /// Location where to store FSR counters (set by options)
-  std::string  m_FSRName;
-
-  /// Reference to file records data service
-  IDataProviderSvc* m_fileRecordSvc;
-
-  IPileUpTool              * m_pileUpTool             ; ///< Pile-up tool
-
-  IDecayTool               * m_decayTool              ; ///< Decay tool
-
-  ICounterLogFile          * m_xmlLogTool             ; ///< Xml Log file tool
-
-  ISampleGenerationTool    * m_sampleGenerationTool   ; ///< Sample tool
-
-  IVertexSmearingTool      * m_vertexSmearingTool     ; ///< Smearing tool
-
-  IFullGenEventCutTool     * m_fullGenEventCutTool    ; ///< Cut tool
-
-  /// Name of the IPileUpTool (set by options).
-  std::string m_pileUpToolName           ;
-
-  /// Name of the ISampleGenerationTool - MinimumBias, ... (set by options)
-  std::string m_sampleGenerationToolName ;
-
-  /// Name of the IDecayTool (set by options)
-  std::string m_decayToolName            ;
-
-  /// Name of the IVertexSmearingTool (set by options)
-  std::string m_vertexSmearingToolName   ;
-
-  /// Name of the IFullGenEventCutTool (set by options)
-  std::string m_fullGenEventCutToolName  ;
-
-  /// Flag to generate all pile up events at the same PV (set by options)
-  bool m_commonVertex ;
-
-  unsigned int m_nEvents ; ///< Number of generated events
-
-  unsigned int m_nAcceptedEvents ; ///< Number of accepted events
-
-  unsigned int m_nInteractions ; ///< Number of generated interactions
-
-  /// Number of interactions in accepted events
-  unsigned int m_nAcceptedInteractions ;
-
-  /// Description of the counter index
-  enum interationCounterType{ Oneb = 0 , ///< interaction with >= 1 b quark
-                              Threeb , ///< interaction with >= 3 b quarks
-                              PromptB , ///< interaction with prompt B
-                              Onec , ///< interaction with >= 1 c quark
-                              Threec , ///< interaction with >= 3 c quarks
-                              PromptC , ///< interaction with prompt C
-                              bAndc ///< interaction with b and c
-  } ;
-
-  /// Type for interaction counter
-  typedef boost::array< unsigned int , 7 > interactionCounter ;
-  typedef boost::array< std::string  , 7 > interactionCNames  ;
-
-  /// Counter of content of generated interactions
-  interactionCounter m_intC ;
-
-  /// Array of counter names
-  interactionCNames  m_intCName ;
-
-  /// Counter of content of accepted interactions
-  interactionCounter m_intCAccepted ;
-
-  /// Array of accepted counter names
-  interactionCNames  m_intCAcceptedName ;
-
-  /// Counter of events before the full event generator level cut
-  unsigned int m_nBeforeFullEvent ;
-
-  /// Counter of events after the full event generator level cut
-  unsigned int m_nAfterFullEvent ;
-
-  /// TDS container
-  /// LHCb::GenFSRs* m_genFSRs;
-  /// FSR for current file
-  LHCb::GenFSR* m_genFSR;
-
-  /** Update the counters counting on interactions.
-   *  @param[in,out] theCounter Counter of events
-   *  @param[in]     theEvent  The interaction to study
-   */
-  void updateInteractionCounters( interactionCounter & theCounter ,
-                                  const LHCb::HepMCEvent * theEvent ) ;
-
-
-  /** Update the counters counting on interactions.
-   *  @param[in,out] m_genFSR     The counters in FSR
-   *  @param[in]     theCounter   The interaction counters
-   *  @param[in]     option       Separate generated and accepted counters
-   */
-  void updateFSRCounters( interactionCounter & theCounter ,
-                          LHCb::GenFSR * m_genFSR,
-                          const std::string option ) ;
-
-};
-#endif // GENERATORS_GENERATION_H
diff --git a/Gen/Generators/src/component/HistoSmearVertex.cpp b/Gen/Generators/src/component/HistoSmearVertex.cpp
deleted file mode 100755
index 6fcabe83b2825311a58d108f2c5a1355cc176430..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/HistoSmearVertex.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// local
-#include "HistoSmearVertex.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-#include "GaudiKernel/PhysicalConstants.h"
-#include "GaudiKernel/Vector4DTypes.h"
-
-// from Event
-#include "Event/HepMCEvent.h"
-#include "TFile.h"
-#include "TH3.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : HistoSmearVertex
-//
-// 2014-08-02 : Dominik Mitzel
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( HistoSmearVertex )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-HistoSmearVertex::HistoSmearVertex( const std::string& type,
-                                    const std::string& name,
-                                    const IInterface* parent )
-  : GaudiTool ( type, name , parent ) {
-    declareInterface< IVertexSmearingTool >( this ) ;
-    declareProperty("InputFileName", m_inputFileName = "");
-    declareProperty("HistogramPath", m_histoPath = "");
-    declareProperty("BeamDirection", m_zDir = 0 );
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-HistoSmearVertex::~HistoSmearVertex( ) { ; }
-
-//=============================================================================
-// Initialize
-//=============================================================================
-StatusCode HistoSmearVertex::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // -- Open the file containing the VX distribution
-  TFile *file = TFile::Open( m_inputFileName.c_str() );
-  if( !file ){
-    error() << "Could not find vertex distribution template file!" << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  // -- Get the histogram template file for the particle momentum spectrum
-  m_hist = (TH3D*) file->Get( m_histoPath.c_str() );
-  if ( !m_hist ) {
-    error() << "Could not find vertex distribution template histogram!" << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  std::string infoMsg = " applying TOF of interaction with ";
-  if ( m_zDir == -1 ) {
-    infoMsg = infoMsg + "negative beam direction";
-  } else if ( m_zDir == 1 ) {
-    infoMsg = infoMsg + "positive beam direction";
-  } else if ( m_zDir == 0 ) {
-    infoMsg = " with TOF of interaction equal to zero ";
-  } else {
-    return Error("BeamDirection can only be set to -1 or 1, or 0 to switch off TOF");
-  }
-
-  info() << "Smearing of interaction point with external  distribution "
-         << " in x, y and z " << endmsg;
-  info() << infoMsg << endmsg;
-
-  return sc ;
-}
-
-//=============================================================================
-// Smearing function
-//=============================================================================
-StatusCode HistoSmearVertex::smearVertex( LHCb::HepMCEvent * theEvent ) {
-  double dx , dy , dz , dt ;
-  m_hist->GetRandom3(dx,dy,dz);
-
-  dt = m_zDir * dz/Gaudi::Units::c_light ;
-
-  Gaudi::LorentzVector dpos( dx , dy , dz , dt ) ;
-
-  HepMC::GenEvent::vertex_iterator vit ;
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-  for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ;
-        ++vit ) {
-    Gaudi::LorentzVector pos ( (*vit) -> position() ) ;
-    pos += dpos ;
-    (*vit) -> set_position( HepMC::FourVector( pos.x() , pos.y() , pos.z() ,
-                                               pos.t() ) ) ;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
diff --git a/Gen/Generators/src/component/HistoSmearVertex.h b/Gen/Generators/src/component/HistoSmearVertex.h
deleted file mode 100644
index 1a1731846f5535cc81f7d599fe0cca80a4570ea6..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/HistoSmearVertex.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef HISTOSMEARVERTEX_H
-#define HISTOSMEARVERTEX_H 1
-
-// Include files
-#include "GaudiAlg/GaudiTool.h"
-#include "Generators/IVertexSmearingTool.h"
-#include "TH3.h"
-
-/** @class SmearVertex SmearVertex.h "SmearVertex.h"
- *
- *  Tool to smear vertex with external input distribution.
- *  Concrete implementation of a IVertexSmearingTool.
- *
- *  @author Dominik Mitzel
- *  @date   2014-08-02
- */
-class HistoSmearVertex : public GaudiTool, virtual public IVertexSmearingTool {
- public:
-  /// Standard constructor
-  HistoSmearVertex( const std::string& type , const std::string& name,
-                    const IInterface* parent ) ;
-  virtual ~HistoSmearVertex( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IVertexSmearingTool::smearVertex.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-  /// Direction of the beam to take into account TOF vs nominal IP8, can have
-  /// only values -1 or 1, or 0 to switch off the TOF and set time of
-  /// interaction to zero (default = 1, as for beam 1)
-  int m_zDir;
-  TH3* m_hist;
-  std::string m_inputFileName;
-  std::string m_histoPath;
-};
-#endif // PARTICLEGUNS_SMEARVERTEX_H
diff --git a/Gen/Generators/src/component/IEvtGenTool.h b/Gen/Generators/src/component/IEvtGenTool.h
deleted file mode 100644
index f57eb2ccb8fb5cdad908c899d04fdd8e09a82dc9..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/IEvtGenTool.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef GENERATORS_IEVTGENTOOL_H
-#define GENERATORS_IEVTGENTOOL_H
-
-#include <string>
-//from Gaudi
-#include "GaudiKernel/IAlgTool.h"
-// from EvtGen
-#include "EvtGen/EvtGen.hh"
-
-/** @class IEvtGenTool IEvtGenTool.h "Generators/IEvtGenTool.h"
-  *
-  * Interface for containter tool for EvtGen
-  *
-  * @author Alex Shires
-  * @date 2011-10-28
-*/
-
-static const InterfaceID IID_IEvtGenTool( "IEvtGenTool", 1, 0 ) ;
-
-class IEvtGenTool : virtual public IAlgTool {
-  public:
-    static const InterfaceID& interfaceID() { return IID_IEvtGenTool ; }
-
-    /* return the pointer to EvtGen
-    */
-    virtual EvtGen * getEvtGen() = 0 ; 
-
-    /* set the EVtGen pointer
-    */
-    virtual void setEvtGen( EvtGen * ) = 0 ; 
-
-    /* return the initialisation status of
-     * EvtGen
-    */
-    virtual bool isInit() = 0 ;
-
-} ; 
-
-#endif // GENERATORS_IEVTGENTOOL_H
diff --git a/Gen/Generators/src/component/Inclusive.cpp b/Gen/Generators/src/component/Inclusive.cpp
deleted file mode 100755
index 36caa54774120bf47ef1e11ee0339a89875eb208..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Inclusive.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-// $Id: Inclusive.cpp,v 1.14 2008-07-04 08:51:29 robbep Exp $
-// Include files
-
-// local
-#include "Inclusive.h"
-
-// from Gaudi
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-
-// from Kernel
-#include "MCInterfaces/IGenCutTool.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "Generators/GenCounters.h"
-#include "Generators/ICounterLogFile.h"
-
-// from Event
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : Inclusive
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( Inclusive )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-Inclusive::Inclusive( const std::string& type, const std::string& name,
-                      const IInterface* parent )
-  : ExternalGenerator  ( type, name , parent ) ,
-    m_xmlLogTool( 0 ) ,
-    m_lightestQuark( LHCb::ParticleID::down ) ,
-    m_nEventsBeforeCut ( 0 ) , m_nEventsAfterCut ( 0 ) ,
-    m_nInvertedEvents  ( 0 ) ,
-    m_ccCounter        ( 0 ) , m_bbCounter( 0 ) ,
-    m_ccCounterAccepted( 0 ) , m_bbCounterAccepted( 0 ) {
-    declareProperty( "InclusivePIDList" , m_pidVector ) ;
-    m_bHadC.assign( 0 )     ;    m_bHadCAccepted.assign( 0 ) ;
-    m_antibHadC.assign( 0 ) ;    m_antibHadCAccepted.assign( 0 ) ;
-    m_cHadC.assign( 0 )     ;    m_cHadCAccepted.assign( 0 ) ;
-    m_anticHadC.assign( 0 ) ;    m_anticHadCAccepted.assign( 0 ) ;
-
-    m_bExcitedC.assign( 0 ) ;    m_bExcitedCAccepted.assign( 0 ) ;
-    m_cExcitedC.assign( 0 ) ;    m_cExcitedCAccepted.assign( 0 ) ;
-
-
-    GenCounters::setupBHadronCountersNames( m_bHadCNames , m_antibHadCNames ) ;
-    GenCounters::setupDHadronCountersNames( m_cHadCNames , m_anticHadCNames ) ;
-
-    GenCounters::setupExcitedCountersNames( m_bExcitedCNames , "B" ) ;
-    GenCounters::setupExcitedCountersNames( m_cExcitedCNames , "D" ) ;
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-Inclusive::~Inclusive( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode Inclusive::initialize( ) {
-  StatusCode sc = ExternalGenerator::initialize( ) ;
-  if ( ! sc.isSuccess() ) return Error( "Cannot initialize base class !" ) ;
-
-  if ( m_pidVector.empty() )
-    return Error( "InclusivePIDList property is not set" ) ;
-
-  // Transform vector into set
-  for ( std::vector<int>::iterator it = m_pidVector.begin() ;
-        it != m_pidVector.end() ; ++it ) m_pids.insert( *it ) ;
-
-  LHCb::IParticlePropertySvc * ppSvc =
-    svc< LHCb::IParticlePropertySvc >( "LHCb::ParticlePropertySvc" ) ;
-
-  info() << "Generating Inclusive events of " ;
-  PIDs::const_iterator it ;
-  bool bottom( false ) , charm( false ) ;
-
-  for ( it = m_pids.begin() ; it != m_pids.end() ; ++it ) {
-    const LHCb::ParticleProperty * prop = ppSvc -> find( LHCb::ParticleID( *it ) ) ;
-    if ( 0 == prop )
-      warning() << "PDG Code " << (*it) << " does not exist." << endmsg ;
-    else {
-      info() << prop -> particle() << " " ;
-      if ( LHCb::ParticleID( prop -> pdgID() ).hasBottom() ) bottom = true ;
-      else if ( LHCb::ParticleID( prop -> pdgID() ).hasCharm()  ) charm  = true ;
-    }
-  }
-
-  if ( bottom && ! charm ) m_lightestQuark = LHCb::ParticleID::bottom ;
-  else if ( charm ) m_lightestQuark = LHCb::ParticleID::charm ;
-  else if (m_pids.size() > 2) return Error( "This case is not yet implemented" ) ;
-
-  info() << endmsg ;
-
-  // XML Log file
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Generate Set of Event for Minimum Bias event type
-//=============================================================================
-bool Inclusive::generate( const unsigned int nPileUp ,
-                          LHCb::HepMCEvents * theEvents ,
-                          LHCb::GenCollisions * theCollisions ) {
-  StatusCode sc ;
-  bool result = false ;
-
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-
-  GenCounters::BHadronCounter thebHadC , theantibHadC ;
-  GenCounters::DHadronCounter thecHadC , theanticHadC ;
-  GenCounters::ExcitedCounter thebExcitedC , thecExcitedC ;
-  unsigned int theccCounter , thebbCounter ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent,
-                        theGenCollision ) ;
-
-    sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-    if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-
-    if ( ! result ) {
-      // Decay particles heavier than the particles to look at
-      // If N hadrons <= 2, we assume it is (h,hbar)
-      // Passing m_pids[0] needed for incl. charmless bottomless hadron production
-      decayHeavyParticles( theGenEvent , m_lightestQuark , m_pids.size() > 2 ? 0 : *(m_pids.begin()) ) ;
-
-      // Check if one particle of the requested list is present in event
-      ParticleVector theParticleList ;
-      if ( checkPresence( m_pids , theGenEvent , theParticleList ) ) {
-        // Update counters
-        thebHadC.assign( 0 )     ;    theantibHadC.assign( 0 ) ;
-        thecHadC.assign( 0 )     ;    theanticHadC.assign( 0 ) ;
-        thebExcitedC.assign( 0 ) ;    thecExcitedC.assign( 0 ) ;
-
-        thebbCounter = 0         ;    theccCounter = 0 ;
-
-        GenCounters::updateHadronCounters( theGenEvent , thebHadC ,
-                                           theantibHadC , thecHadC ,
-                                           theanticHadC , thebbCounter ,
-                                           theccCounter ) ;
-        GenCounters::updateExcitedStatesCounters( theGenEvent , thebExcitedC ,
-                                                  thecExcitedC ) ;
-
-        // Accumulate counters
-        GenCounters::AddTo( m_bHadC , thebHadC ) ;
-        GenCounters::AddTo( m_antibHadC , theantibHadC ) ;
-        GenCounters::AddTo( m_cHadC , thecHadC ) ;
-        GenCounters::AddTo( m_anticHadC , theanticHadC ) ;
-
-        m_bbCounter += thebbCounter ;  m_ccCounter += theccCounter ;
-
-        GenCounters::AddTo( m_bExcitedC , thebExcitedC ) ;
-        GenCounters::AddTo( m_cExcitedC , thecExcitedC ) ;
-
-        if(genFSR) GenCounters::updateHadronFSR( theGenEvent, genFSR, "Gen");
-
-        ++m_nEventsBeforeCut ;
-        key = LHCb::GenCountersFSR::BeforeLevelCut;
-        if(genFSR) genFSR->incrementGenCounter(key, 1);
-        bool passCut = true ;
-        if ( 0 != m_cutTool )
-          passCut = m_cutTool -> applyCut( theParticleList , theGenEvent ,
-                                           theGenCollision ) ;
-
-        if ( passCut && ( ! theParticleList.empty() ) ) {
-          ++m_nEventsAfterCut ;
-          result = true ;
-
-          theGenCollision -> setIsSignal( true ) ;
-
-          if ( 0 == nPositivePz( theParticleList ) ) {
-            revertEvent( theGenEvent ) ;
-            ++m_nInvertedEvents ;
-            key = LHCb::GenCountersFSR::EvtInverted;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-          else
-          {
-            key = LHCb::GenCountersFSR::AfterLevelCut;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-
-          GenCounters::AddTo( m_bHadCAccepted , thebHadC ) ;
-          GenCounters::AddTo( m_antibHadCAccepted , theantibHadC ) ;
-          GenCounters::AddTo( m_cHadCAccepted , thecHadC ) ;
-          GenCounters::AddTo( m_anticHadCAccepted , theanticHadC ) ;
-
-          GenCounters::AddTo( m_bExcitedCAccepted , thebExcitedC ) ;
-          GenCounters::AddTo( m_cExcitedCAccepted , thecExcitedC ) ;
-
-          if(genFSR) GenCounters::updateHadronFSR( theGenEvent, genFSR, "Acc");
-        }
-      }
-    }
-  }
-
-  return result ;
-}
-
-//=============================================================================
-// Print the counters
-//=============================================================================
-void Inclusive::printCounters( ) const {
-  using namespace GenCounters ;
-
-  printEfficiency( m_xmlLogTool , "generator level cut" ,
-                   m_nEventsAfterCut - m_nInvertedEvents ,
-                   m_nEventsBeforeCut ) ;
-  printCounter( m_xmlLogTool , "z-inverted events" , m_nInvertedEvents ) ;
-
-  printArray( m_xmlLogTool , m_bHadC , m_bHadCNames , "generated" ) ;
-  printArray( m_xmlLogTool , m_antibHadC , m_antibHadCNames , "generated" ) ;
-  printCounter( m_xmlLogTool , "generated (bb)" , m_bbCounter ) ;
-
-  printArray( m_xmlLogTool , m_cHadC , m_cHadCNames , "generated" ) ;
-  printArray( m_xmlLogTool , m_anticHadC , m_anticHadCNames , "generated" ) ;
-  printCounter( m_xmlLogTool , "generated (cc)" , m_ccCounter ) ;
-
-  printArray( m_xmlLogTool , m_bHadCAccepted , m_bHadCNames , "accepted" ) ;
-  printArray( m_xmlLogTool , m_antibHadCAccepted , m_antibHadCNames , "accepted" ) ;
-  printCounter( m_xmlLogTool , "accepted (bb)" , m_bbCounterAccepted ) ;
-
-  printArray( m_xmlLogTool , m_cHadCAccepted , m_cHadCNames , "accepted" ) ;
-  printArray( m_xmlLogTool , m_anticHadCAccepted , m_anticHadCNames , "accepted" ) ;
-  printCounter( m_xmlLogTool , "accepted (cc)" , m_ccCounterAccepted ) ;
-
-  printArray( m_xmlLogTool , m_bExcitedC , m_bExcitedCNames , "generated" ) ;
-  printArray( m_xmlLogTool , m_bExcitedCAccepted , m_bExcitedCNames , "accepted" ) ;
-
-  printArray( m_xmlLogTool , m_cExcitedC , m_cExcitedCNames , "generated" ) ;
-  printArray( m_xmlLogTool , m_cExcitedCAccepted , m_cExcitedCNames , "accepted" ) ;
-}
-
diff --git a/Gen/Generators/src/component/Inclusive.h b/Gen/Generators/src/component/Inclusive.h
deleted file mode 100755
index 7bfc2c7c21fa30bc9842f891bd54cf3bce36496f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Inclusive.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// $Id: Inclusive.h,v 1.7 2006-02-17 13:26:44 robbep Exp $
-#ifndef GENERATORS_INCLUSIVE_H
-#define GENERATORS_INCLUSIVE_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-
-#include "Generators/ExternalGenerator.h"
-
-#include "Generators/GenCounters.h"
-
-#include <boost/array.hpp>
-
-// forward declarations
-
-namespace HepMC {
-  class GenParticle ;
-}
-
-class ICounterLogFile ;
-
-/** @class Inclusive Inclusive.h "Inclusive.h"
- *
- *  Tool for inclusive samples generation. The particles to
- *  request are specified by their PDG Id in a list. Concrete
- *  implementation of a ISampleGenerationTool using the
- *  ExternalGenerator base class.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class Inclusive : public ExternalGenerator {
- public:
-  /// Standard constructor
-  Inclusive( const std::string& type, const std::string& name,
-             const IInterface* parent);
-
-  virtual ~Inclusive( ); ///< Destructor
-
-  /** Initialize method
-   *  Find the lightest particle among the requested particles.
-   *  When generating events, all particles heavier than this mass
-   *  will be decayed with the IDecayTool before the event is analyzed
-   *  to see if it contains particles of the inclusive list.
-   */
-  StatusCode initialize( ) override;
-
-  /** Generate a set of interactions.
-   *  Implements ISampleGenerationTool::generate.
-   *  -# Generate interactions using the IProductionTool
-   *  -# Check if the interaction has a particle specified in
-   *     the PID list
-   *  -# Apply the IGenCutTool on the interaction containing
-   *     a particle of the list.
-   *  -# Parity-flip the event (z -> -z, pz -> -pz) if all particles
-   *     of the inclusive list in the event have pz < 0.
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-  /** Print generation counters.
-   *  Implements ISampleGenerationTool::printCounters.
-   *  Prints (after generator level cuts):
-   *  -# Fractions of B0/B+/B0s/Bc/b-Baryons (and idem for D) in
-   *     selected events.
-   *  -# Fractions of B/Bstar/Bdoublestar in selected events.
-   */
-  void printCounters( ) const override;
-
- protected:
-
- private:
-  ICounterLogFile * m_xmlLogTool ; ///< XML log file for counters
-
-  /// Type of lightest quark in list of particles to produce
-  LHCb::ParticleID::Quark      m_lightestQuark     ;
-
-  /// Counter of events before applying generator level cut
-  unsigned int  m_nEventsBeforeCut ;
-
-  /// Counter of events after applying generator level cut
-  unsigned int  m_nEventsAfterCut  ;
-
-  /// Counter of parity-flipped events (z -> -z, pz -> -pz)
-  unsigned int  m_nInvertedEvents  ;
-
-  /// Ordered set of PDG Id of particles to produce (set by options)
-  PIDs          m_pids             ;
-
-  /// Vector to obtain list of PDG Ids from job options
-  std::vector< int > m_pidVector   ;
-
-  GenCounters::BHadronCounter m_bHadC ;  ///< Counter of B hadron (generated)
-
-  GenCounters::BHadronCounter m_antibHadC ; ///< Counter of Bbar hadron (gen)
-
-  /// Counter of B hadron (accepted)
-  GenCounters::BHadronCounter m_bHadCAccepted ;
-
-  /// Counter of anti-B hadron (accepted)
-  GenCounters::BHadronCounter m_antibHadCAccepted ;
-
-  GenCounters::BHadronCNames m_bHadCNames ; ///< Array of B counter names
-
-  /// Array of anti-B hadrons names
-  GenCounters::BHadronCNames m_antibHadCNames ;
-
-  GenCounters::DHadronCounter m_cHadC ; ///< Counter of D hadron (generated)
-
-  GenCounters::DHadronCounter m_anticHadC ; ///< Counter of Dbar hadron (gen)
-
-  /// Counter of D hadron (accepted)
-  GenCounters::DHadronCounter m_cHadCAccepted ;
-
-  /// Counter of D hadron (accepted)
-  GenCounters::DHadronCounter m_anticHadCAccepted ;
-
-  /// Array of D counter names
-  GenCounters::DHadronCNames m_cHadCNames ;
-
-  /// Array of anti-D counter names
-  GenCounters::DHadronCNames m_anticHadCNames ;
-
-  unsigned int m_ccCounter ; ///< Counter for cc quarkonium (generated)
-
-  unsigned int m_bbCounter ; ///< Counter for bb quarkonium (generated)
-
-  unsigned int m_ccCounterAccepted ; ///< Counter for cc (accepted)
-
-  unsigned int m_bbCounterAccepted ; ///<< Counter for bb (accepted)
-
-  GenCounters::ExcitedCounter m_bExcitedC ; ///< Counter of B(**) (generated)
-
-  GenCounters::ExcitedCounter m_cExcitedC ; ///< Counter of D(**) (generated)
-
-  /// Counter of B(**) (accepted)
-  GenCounters::ExcitedCounter m_bExcitedCAccepted ;
-
-  /// Counter of D(**) (accepted)
-  GenCounters::ExcitedCounter m_cExcitedCAccepted ;
-
-  GenCounters::ExcitedCNames m_bExcitedCNames ; ///< Names excited B counters
-
-  GenCounters::ExcitedCNames m_cExcitedCNames ; ///< Names excited D counters
-};
-#endif // GENERATORS_INCLUSIVE_H
diff --git a/Gen/Generators/src/component/MergedEventsFilter.cpp b/Gen/Generators/src/component/MergedEventsFilter.cpp
deleted file mode 100755
index f51421e376e1763a3ef56b9d58f89b0cf5526608..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/MergedEventsFilter.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// $Id: MergedEventsFilter.cpp,v 1.1 2008-05-06 08:27:55 gcorti Exp $
-// Include files 
-
-// from Gaudi
-
-// from LHCb
-#include "Event/GenHeader.h"
-#include "Event/GenCollision.h"
-
-// from Kernel
-#include "MCInterfaces/IFullGenEventCutTool.h"
-
-// local
-#include "MergedEventsFilter.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : MergedEventsFilter
-//
-// 2008-04-30 : Gloria CORTI
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( MergedEventsFilter )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-MergedEventsFilter::MergedEventsFilter( const std::string& name,
-                                        ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator )
-  , m_fullGenEventCutTool  ( 0 )
-{
-  
-    // Tool name to cut on full event
-    declareProperty( "FullGenEventCutTool" , 
-                     m_fullGenEventCutToolName = "" ) ;
-    // Location of the input from the generation
-    declareProperty ( "HepMCEventLocation" , m_hepMCEventLocation = 
-                      LHCb::HepMCEventLocation::Default ) ;
-    declareProperty ( "GenCollisionLocation" , m_genCollisionLocation = 
-                      LHCb::GenCollisionLocation::Default ) ;
-    
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-MergedEventsFilter::~MergedEventsFilter() {} 
-
-//=============================================================================
-// Initialization
-//=============================================================================
-StatusCode MergedEventsFilter::initialize() {
-  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
-
-  // Retrieve full gen event cut tool
-  if ( "" != m_fullGenEventCutToolName ) {
-    m_fullGenEventCutTool =
-      tool< IFullGenEventCutTool >( m_fullGenEventCutToolName , this ) ;
-  }
-  else {
-    info() << "Filter does not have a cut::: MUST be specified!!!" << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode MergedEventsFilter::execute() {
-
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
-
-  // Retrieve info from the TES
-  LHCb::HepMCEvents* theEvents = 
-    get<LHCb::HepMCEvents>( m_hepMCEventLocation );
-
-  LHCb::GenCollisions* theCollisions = 
-    get<LHCb::GenCollisions>( m_genCollisionLocation );
-  
-
-  // Apply generator level cut on full event
-  bool goodEvent = true;
-  
-  //  ++m_nBeforeFullEvent ;
-  goodEvent = m_fullGenEventCutTool->studyFullEvent( theEvents, theCollisions );
-  // put counters
-  setFilterPassed(goodEvent);
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode MergedEventsFilter::finalize() {
-
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
-
-  return GaudiAlgorithm::finalize();  // must be called after all other actions
-}
-
-//=============================================================================
diff --git a/Gen/Generators/src/component/MergedEventsFilter.h b/Gen/Generators/src/component/MergedEventsFilter.h
deleted file mode 100755
index a17ad3ca736f01d82578dc4e5e0ad9fce960717e..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/MergedEventsFilter.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: MergedEventsFilter.h,v 1.1 2008-05-06 08:27:55 gcorti Exp $
-#ifndef GENERATORS_MERGEDEVENTSFILTER_H
-#define GENERATORS_MERGEDEVENTSFILTER_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-class IFullGenEventCutTool;
-
-/** @class MergedEventsFilter MergedEventsFilter.h component/MergedEventsFilter.h
- *
- *
- *  @author Gloria CORTI
- *  @date   2008-04-30
- */
-class MergedEventsFilter : public GaudiAlgorithm {
-public:
-  /// Standard constructor
-  MergedEventsFilter( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~MergedEventsFilter( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
-
-protected:
-
-private:
-
-  std::string  m_hepMCEventLocation ;    ///< Input TES for HepMC events
-  std::string  m_genCollisionLocation ;  ///< Input TES for GenCollisions
-
-  std::string           m_fullGenEventCutToolName; ///< Name of event cut tool
-  IFullGenEventCutTool* m_fullGenEventCutTool;     ///< Pointer to event cut tool
-
-};
-#endif // GENERATORS_MERGEDEVENTSFILTER_H
diff --git a/Gen/Generators/src/component/MinimumBias.cpp b/Gen/Generators/src/component/MinimumBias.cpp
deleted file mode 100755
index 122bb097795a578222ac8ceee8c38614dc1d62ec..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/MinimumBias.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id: MinimumBias.cpp,v 1.4 2007-01-12 15:17:38 ranjard Exp $
-// Include files 
-
-// local
-#include "MinimumBias.h"
-// from Gaudi
-
-#include "Generators/IProductionTool.h"
-
-// Event 
-#include "Event/HepMCEvent.h"
-#include "Event/GenCollision.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : MinimumBias
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( MinimumBias )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-MinimumBias::MinimumBias( const std::string & type , const std::string & name,
-                          const IInterface * parent )
-  : ExternalGenerator( type, name , parent ) { }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-MinimumBias::~MinimumBias( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode MinimumBias::initialize( ) {
-  info() << "Generating Minimum Bias events." << endmsg ;
-  return ExternalGenerator::initialize( ) ;
-}
-
-//=============================================================================
-// Generate Set of Event for Minimum Bias event type
-//=============================================================================
-bool MinimumBias::generate( const unsigned int nPileUp , 
-                            LHCb::HepMCEvents * theEvents , 
-                            LHCb::GenCollisions * theCollisions ) {
-  StatusCode sc ;
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-  
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent , 
-                        theGenCollision ) ;
-    
-    sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-    if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-  } 
-  return true ;
-}
diff --git a/Gen/Generators/src/component/MinimumBias.h b/Gen/Generators/src/component/MinimumBias.h
deleted file mode 100755
index 62f79c47437db2e14223f83fb1f141f830216176..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/MinimumBias.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: MinimumBias.h,v 1.3 2005-12-31 17:33:12 robbep Exp $
-#ifndef GENERATORS_MINIMUMBIAS_H
-#define GENERATORS_MINIMUMBIAS_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "Generators/ExternalGenerator.h"
-
-/** @class MinimumBias MinimumBias.h "MinimumBias.h"
- *
- *  Tool for minimum bias generation. Concrete implementation
- *  of ISampleGenerationTool using the base class ExternalGenerator.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class MinimumBias : public ExternalGenerator {
- public:
-  /// Standard constructor
-  MinimumBias( const std::string & type , const std::string & name ,
-               const IInterface * parent ) ;
-
-  virtual ~MinimumBias( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Generate minimum bias interactions without any cut.
-   *  Implements ISampleGeneratorTool::generate.
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-  /// Implements ISampleGeneratorTool::printCounters
-  void printCounters( ) const override { ; }
-};
-#endif // GENERATORS_MINIMUMBIAS_H
diff --git a/Gen/Generators/src/component/ReadHepMCAsciiFile.cpp b/Gen/Generators/src/component/ReadHepMCAsciiFile.cpp
deleted file mode 100755
index 3a8f4fe1c0e16893506330ddeb1a1635c5b3730b..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/ReadHepMCAsciiFile.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-// $Id: ReadHepMCAsciiFile.cpp,v 1.5 2009-03-02 12:12:35 robbep Exp $
-// ===========================================================================
-// Include files
-// ===========================================================================
-// GaudiKernel
-// ===========================================================================
-#include "GaudiKernel/SystemOfUnits.h"
-#include "GaudiKernel/PhysicalConstants.h"
-// ===========================================================================
-// GaudiAlg
-// ===========================================================================
-#include "GaudiAlg/GaudiTool.h"
-// ===========================================================================
-// Generators
-// ===========================================================================
-#include "Generators/IProductionTool.h"
-// ===========================================================================
-// HepMC
-// ===========================================================================
-#include "HepMC/IO_GenEvent.h"
-#include "HepMC/Units.h"
-// ===========================================================================
-/** @class ReadHepMCAsciiFile ReadHepMCAsciiFile.cpp
- *
- *  Simple "production tool", which actually reads HepMC events
- *  from  ascii input file. The tool could be useful to read
- *  information from external generators, if their integration
- *  into Gauss is impossible, difficult or not needed.
- *
- *  The tool has 2 properties:
- *
- *    - <c>Input</c>  : The name of input fiel in HepMC Ascii format
- *                    ( the default value is <c>""</c> (empty string))
- *    - <c>Rescale<c> : Boolean flag to rescal the input event from
- *                     Pythia units to LHCb units.
- *                     The default value is <c>true</c>.
- *
- *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
- *  @date 2005-10-05
- */
-class ReadHepMCAsciiFile
-  :         public       GaudiTool
-  , virtual public IProductionTool
-{
-public:
-  /// initialization of the tool
-  StatusCode initialize () override
-  {
-    StatusCode sc = GaudiTool::initialize () ;
-    if ( sc.isFailure() ) { return sc ; }
-    /// check the output file
-    if ( m_input.empty() )
-    { return Error ( "Input file name is not specified!" ) ; }
-    // open the file
-    m_file = new HepMC::IO_GenEvent ( m_input.c_str() , std::ios::in ) ;
-    //
-    if ( ( 0 == m_file ) || ( m_file->rdstate() == std::ios::failbit ) )
-    { return Error ( "Failure to input the file '"+m_input+"'" ) ; }
-    //
-    return StatusCode::SUCCESS ;
-  }
-  /// finalization of the tool
-  StatusCode finalize   () override
-  {
-    // delete the stream  (close the file!)
-    if ( 0 != m_file ) { delete m_file ; m_file = 0 ; }
-    // finalize the base class ;
-    return GaudiTool::finalize() ;
-  }
-public:
-  StatusCode initializeGenerator() override { return StatusCode::SUCCESS ; }
-
-  // ===================================================================
-  /** Generate a primary interaction.
-   *  The generated event contains all what happens up to the decay of
-   *  hadrons. Decay of hadrons will be performed in general by the decay
-   *  tool. Then all hadrons must be declared stable in the production
-   *  generator. This is done thanks to IProductionTool::setStable.
-   *  @param[out] theEvent  Event generated by the production generator.
-   *  @param[out] theInfo   Informations about the hard process of the
-   *                        generated interaction.
-   */
-  StatusCode generateEvent
-  ( HepMC::GenEvent    * theEvent ,
-    LHCb::GenCollision * theInfo  ) override;
-  // ===================================================================
-  /// Declare a particle stable to the production generator.
-  void setStable
-  ( const LHCb::ParticleProperty * /* thePP */ ) override { }
-  // ===================================================================
-  /** Update the properties of the particle in the production generator
-   *  with values from the particle property service.
-   */
-  // ===================================================================
-  void updateParticleProperties
-  ( const LHCb::ParticleProperty * /* thePP */ ) override {};
-  // ===================================================================
-  /// Turn off the fragmentation step in the generation.
-  void turnOffFragmentation  ( ) override {} ;
-  // ===================================================================
-  /// Turn on the fragmentation step in the generation.
-  void turnOnFragmentation   ( )  override {}  ;
-  // ===================================================================
-  /** Hadronize the event.
-   *  @param[in,out] theEvent  Unfragmented event to hadronize.
-   *  @param[out]    theInfo   Informations about the hard process of the
-   *                           generated interaction.
-   */
-  StatusCode hadronize
-  ( HepMC::GenEvent*     /* theEvent */ ,
-    LHCb::GenCollision * /* theInfo  */ ) override { return StatusCode::SUCCESS ; }
-  // ===================================================================
-  /// Save the parton level event (when the fragmentation is turned off)
-  void savePartonEvent
-  ( HepMC::GenEvent * /* theEvent */ ) override {} ;
-  // ===================================================================
-  /// Retrieve the previously saved parton event to re-hadronize it.
-  void retrievePartonEvent
-  ( HepMC::GenEvent* /* theEvent */ ) override {} ;
-  // ===================================================================
-  /// Print configuration of production generator
-  void printRunningConditions( ) override {} ;
-  // ===================================================================
-  /** Define special particles whose properties must not be updated from
-   *  the particle property service (like mass of top quark, ...)
-   */
-  bool isSpecialParticle
-  ( const LHCb::ParticleProperty* /* thePP */ ) const override { return true ; }
-  // ===================================================================
-  /// Prepare the generator to force fragmentationto in the thePdgId flavour.
-  StatusCode setupForcedFragmentation
-  ( const int /* thePdgId */ ) override { return StatusCode::SUCCESS ; };
-  // ===================================================================
-  /** standard constructor
-   *  @param type tool type(?)
-   *  @param name tool name
-   *  @param parent parent  component
-   */
-  ReadHepMCAsciiFile
-  ( const std::string& type,
-    const std::string& name,
-    const IInterface* parent )
-    : GaudiTool ( type , name , parent )
-    // no default
-    , m_input () ///< no default input file name
-    // the fiel itself
-    , m_file    ( 0    ) ///< the fiel itself
-  {
-    declareInterface<IProductionTool> ( this ) ;
-
-    declareProperty  ( "Input"   , m_input   ) ;
-  }
- virtual ~ReadHepMCAsciiFile()
-  {
-    // delete the stream  (close the file!)
-    if ( 0 != m_file ) { delete m_file ; m_file = 0 ; }
-  };
-private:
-  // the name of the input file
-  std::string      m_input ; ///< the name of the input file
-  // rescale event from Pythia to LHCb units ?
-  // the output file ;
-  HepMC::IO_GenEvent* m_file   ; ///< the input file ;
-} ;
-// =====================================================================
-/// Declaration of the Tool Factory
-// =====================================================================
-DECLARE_COMPONENT( ReadHepMCAsciiFile )
-// =====================================================================
-/** Generate a primary interaction.
- *  The generated event contains all what happens up to the decay of
- *  hadrons. Decay of hadrons will be performed in general by the decay
- *  tool. Then all hadrons must be declared stable in the production
- *  generator. This is done thanks to IProductionTool::setStable.
- *  @param[out] theEvent  Event generated by the production generator.
- *  @param[out] theInfo   Informations about the hard process of the
- *                        generated interaction.
- */
-
-// ===================================================================
-StatusCode ReadHepMCAsciiFile::generateEvent
-( HepMC::GenEvent    *    theEvent ,
-  LHCb::GenCollision * /* theInfo */ )
-{
-  Assert ( 0 != m_file , "Invalid input file!" ) ;
-  //
-  if ( !m_file->fill_next_event( theEvent ) )
-  { if ( m_file -> rdstate() != std::ios::eofbit )
-	return Error ( "Error in event reading!" ) ;
-    else return Error( "No more events in input file, set correct number of events in options" ) ;
-    ;
-  }
-  theEvent->use_units(HepMC::Units::MEV, HepMC::Units::MM);
-  //
-  return StatusCode::SUCCESS ;
-}
-
-
-// =====================================================================
-// The END
-// =====================================================================
diff --git a/Gen/Generators/src/component/RepeatDecay.cpp b/Gen/Generators/src/component/RepeatDecay.cpp
deleted file mode 100755
index 9d401496db516f3ea2b8a217771758ab684eb9d7..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/RepeatDecay.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// $Id: RepeatDecay.cpp,v 1.1 2007-04-01 21:28:12 robbep Exp $
-// Include files 
-
-// local
-#include "RepeatDecay.h"
-
-// from Gaudi
-
-// from Generators
-#include "Generators/ISampleGenerationTool.h"
-#include "GenEvent/HepMCUtils.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : RepeatDecay
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( RepeatDecay )
-
-//=======================================================
-// Standard constructor, initializes variables
-//=======================================================
-RepeatDecay::RepeatDecay( const std::string& type, 
-                          const std::string& name,
-                          const IInterface* parent )
-  : GaudiTool  ( type, name , parent )  ,
-    m_baseTool( 0 ) ,
-    m_nRedecay( 0 )  { 
-  declareInterface< ISampleGenerationTool >( this ) ;
-  declareProperty( "BaseTool" , m_baseToolName = "Inclusive" ) ;
-  declareProperty( "NRedecay" , m_nRedecayLimit = 50 ) ;
-}
-
-//=======================================================
-// Destructor
-//=======================================================
-RepeatDecay::~RepeatDecay( ) { ; }
-
-//=======================================================
-// Initialize method
-//=======================================================
-StatusCode RepeatDecay::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( ! sc.isSuccess() ) return Error( "Cannot initialize base class !" ) ;
-
-  if ( "" == m_baseToolName ) 
-    return Error( "No name given for Base Tool" ) ;
-
-  info() << "Generating repeated events using base events of type "
-         << m_baseToolName << endmsg ;
-
-  m_baseTool = tool< ISampleGenerationTool >( m_baseToolName , this ) ;
-
-  m_theMemorizedEvents.clear() ;
-  m_theMemorizedCollisions.clear() ;
-
-  return sc ;
-}
-
-//===================================================
-// Generate Set of Event for Minimum Bias event type
-//===================================================
-bool RepeatDecay::generate( const unsigned int nPileUp , 
-                            LHCb::HepMCEvents * theEvents , 
-                            LHCb::GenCollisions * theCollisions ) {
-  bool result = false ;
-
-  if ( ( m_theMemorizedEvents.empty() ) || 
-       ( m_nRedecay > m_nRedecayLimit ) ) {
-    m_theMemorizedEvents.clear() ;
-    m_theMemorizedCollisions.clear() ;
-    m_nRedecay = 0 ;
-    
-    result = m_baseTool -> generate( nPileUp , theEvents , theCollisions ) ;  
-    if ( result ) {
-      // Erase decays before storing the event
-      LHCb::HepMCEvents::iterator it ;
-      std::vector< HepMC::GenParticle * > eraseList ;
-      
-      for ( it = theEvents -> begin() ; it != theEvents -> end() ; ++it ) {
-        HepMC::GenEvent * ev = (*it) -> pGenEvt() ;
-        for ( HepMC::GenEvent::particle_iterator itP = ev -> particles_begin()
-                ; itP != ev -> particles_end() ; ++itP ) {
-          if ( LHCb::HepMCEvent::DecayedByDecayGenAndProducedByProdGen ==
-               (*itP) -> status() )
-            eraseList.push_back( (*itP) ) ;
-        }
-      }
-      
-      for ( std::vector< HepMC::GenParticle * >::iterator part = 
-              eraseList.begin() ;
-            part != eraseList.end() ; ++part ) 
-        HepMCUtils::RemoveDaughters( (*part) ) ;
-
-      copyEvents( theEvents , &m_theMemorizedEvents ) ;
-      copyCollisions( theCollisions , &m_theMemorizedCollisions , theEvents ) ;
-    }
-  } else {
-    ++m_nRedecay ;
-    
-    copyEvents( &m_theMemorizedEvents , theEvents ) ;
-    copyCollisions( &m_theMemorizedCollisions , theCollisions , 
-                    &m_theMemorizedEvents ) ;
-    result = true ;
-  }
-  
-  return result ;
-}
-
-//===================================================
-// Print the counters
-//===================================================
-void RepeatDecay::printCounters( ) const {
-  m_baseTool -> printCounters() ;
-}
-
-//===================================================
-// Copy a HepMCEvent to another
-//===================================================
-void RepeatDecay::copyEvents( LHCb::HepMCEvents * from , 
-                              LHCb::HepMCEvents * to ) {
-  // Erase the event where to copy
-  to -> clear() ;
-
-  LHCb::HepMCEvents::iterator it ;
-  for ( it = from -> begin() ; it != from -> end() ; ++it ) {
-    LHCb::HepMCEvent * theHepMCEvent = new LHCb::HepMCEvent( ) ;
-    theHepMCEvent -> setGeneratorName( (*it) -> generatorName() ) ;
-    (*theHepMCEvent -> pGenEvt()) = (*(*it) -> pGenEvt()) ;
-    to -> insert( theHepMCEvent ) ;
-  } 
-}
-
-//===================================================
-// Copy a HepMCEvent to another
-//===================================================
-void RepeatDecay::copyCollisions( LHCb::GenCollisions * from , 
-                                  LHCb::GenCollisions * to ,
-                                  LHCb::HepMCEvents * theEvents ) {
-  // Erase the event where to copy
-  to -> clear() ;
-
-  LHCb::GenCollisions::iterator it ;
-  LHCb::HepMCEvents::iterator itEvents = theEvents -> begin() ;
-  
-  for ( it = from -> begin() ; it != from -> end() ; ++it ) {
-    LHCb::GenCollision * theGenCollision = new LHCb::GenCollision( ) ;
-    theGenCollision -> setIsSignal( (*it) -> isSignal() ) ;
-    theGenCollision -> setProcessType( (*it) -> processType() ) ;
-    theGenCollision -> setSHat( (*it) -> sHat() ) ;
-    theGenCollision -> setTHat( (*it) -> tHat() ) ;
-    theGenCollision -> setUHat( (*it) -> uHat() ) ;
-    theGenCollision -> setPtHat( (*it) -> ptHat() ) ;
-    theGenCollision -> setX1Bjorken( (*it) -> x1Bjorken() ) ;
-    theGenCollision -> setX2Bjorken( (*it) -> x2Bjorken() ) ;
-    theGenCollision -> setEvent( (*itEvents) ) ;
-    
-    to -> insert( theGenCollision ) ;
-    ++itEvents ;
-  } 
-}
diff --git a/Gen/Generators/src/component/RepeatDecay.h b/Gen/Generators/src/component/RepeatDecay.h
deleted file mode 100755
index f15906c41824c2c42f925e38af17c478273ebac0..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/RepeatDecay.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// $Id: RepeatDecay.h,v 1.1 2007-04-01 21:28:12 robbep Exp $
-#ifndef GENERATORS_REPEATDECAY_H
-#define GENERATORS_REPEATDECAY_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-
-#include "Generators/ISampleGenerationTool.h"
-
-// forward declarations
-
-namespace HepMC {
-  class GenParticle ;
-}
-
-/** @class RepeatDecay RepeatDecay.h "RepeatDecay.h"
- *
- *  Tool for the generation of samples re-using the same event
- *  several times and re-decaying it only. When an event has been found
- *  passing the generator level cut, it is kept and re-decayed several times
- *  (applying again the same cut on it).
- *  Concrete implementation of a ISampleGenerationTool .
- *
- *  @author Patrick Robbe
- *  @date   2007-03-31
- */
-class RepeatDecay : public GaudiTool ,
-                    virtual public ISampleGenerationTool  {
- public:
-  /// Standard constructor
-  RepeatDecay( const std::string& type, const std::string& name,
-             const IInterface* parent);
-
-  virtual ~RepeatDecay( ); ///< Destructor
-
-  /** Initialize method
-   */
-  StatusCode initialize( ) override;
-
-  /** Generate a set of interactions.
-   *  Implements ISampleGenerationTool::generate.
-   *  -# Generate a set of interactions with the ISampleGenerationTool,
-   *       if there is no event in memory or the same event has been re-used
-   *       too many times.
-   *  -# If there is an event in memory, just erase the particles in it.
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-  /** Print generation counters.
-   *  Implements ISampleGenerationTool::printCounters.
-   */
-  void printCounters( ) const override;
-
- protected:
-
- private:
-
-  /// Name of the tool used to generate the events (set by option)
-  std::string m_baseToolName ;
-
-  /// Tool used to generate the base events which are re-decayed
-  ISampleGenerationTool * m_baseTool ;
-
-  /// Number of times to redecay the events (set by option)
-  unsigned int m_nRedecayLimit ;
-
-  /// counter of repetitions
-  unsigned int m_nRedecay ;
-
-  /// Memorized events
-  LHCb::HepMCEvents m_theMemorizedEvents ;
-
-  /// Memorized collisions
-  LHCb::GenCollisions m_theMemorizedCollisions ;
-
-  /// Copy a set of events into another
-  void copyEvents( LHCb::HepMCEvents * from ,
-                   LHCb::HepMCEvents * to )  ;
-
-  /* Copy a set of collisions into another, with the list of corresponding
-   * events
-   */
-  void copyCollisions( LHCb::GenCollisions * from , LHCb::GenCollisions * to ,
-                       LHCb::HepMCEvents * theEvents ) ;
-};
-#endif // GENERATORS_REPEATDECAY_H
diff --git a/Gen/Generators/src/component/SaveSignalBInformation.cpp b/Gen/Generators/src/component/SaveSignalBInformation.cpp
deleted file mode 100644
index 2343e67b7863a69529de8e21a25b92ae97142188..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SaveSignalBInformation.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// Include files
-
-// from Gaudi
-
-// from Event
-#include "Event/HepMCEvent.h"
-
-// from Generators
-#include "GenEvent/HepMCUtils.h"
-
-// local
-#include "SaveSignalBInformation.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : SaveSignalBInformation
-//
-// 2013-06-26 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( SaveSignalBInformation )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-SaveSignalBInformation::SaveSignalBInformation( const std::string& name,
-                                                ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator )
-{
-  declareProperty( "InputHepMCEvent" , m_inputHepMCEvent =
-                   LHCb::HepMCEventLocation::Default ) ;
-  declareProperty( "OutputHepMCEvent" , m_outputHepMCEvent = 
-                   "Gen/BInfo" ) ;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode SaveSignalBInformation::execute() {
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
-
-  // loop over input HepMC
-  SmartDataPtr< LHCb::HepMCEvents > hepMCptr( eventSvc() , 
-                                              m_inputHepMCEvent ) ;
-  
-  StatusCode sc = StatusCode::SUCCESS ;
-  
-  if ( 0 == hepMCptr ) {
-    info() << "No HepMCEvents at location " << m_inputHepMCEvent 
-           << endmsg ;
-  } else {
-    LHCb::HepMCEvents::iterator it ;
-    for ( it = hepMCptr -> begin() ; it != hepMCptr -> end() ; ++it ) {
-      // check if signal exists
-      if ( 0 != (*it) -> pGenEvt() -> signal_process_vertex() ) {
-        sc = extractSignal( (*it) -> pGenEvt() -> signal_process_vertex() ) ;
-        break ;
-      }
-    }
-  }
-
-  return sc ;
-}
-
-//=============================================================================
-// Extract B string and copy to a new location
-//=============================================================================
-StatusCode SaveSignalBInformation::extractSignal( const HepMC::GenVertex *
-                                                  theVertex ) const {
-  HepMC::GenParticle * HEPB0 = *( theVertex -> particles_in_const_begin() ) ;
-  HepMC::GenParticle * Bstring = 0 ;
-
-  // look for the string associated to the signal
-  for ( HepMC::GenVertex::particle_iterator iances = 
-          HEPB0->production_vertex()-> particles_begin(HepMC::ancestors);
-        iances != HEPB0->production_vertex()-> particles_end(HepMC::ancestors) ;
-        ++iances ) {
-    int genid = abs( (*iances) -> pdg_id() ) ;
-    if ( ( 91 == genid ) || ( 92 == genid ) ) { 
-      Bstring = (*iances) ; break ; 
-    }
-  }
-
-  if ( 0 != Bstring ) {
-    // copy the string in a new event
-    LHCb::HepMCEvent * mcevt = new LHCb::HepMCEvent( ) ;
-    mcevt -> setGeneratorName( "String" ) ;
-    
-    if ( 0 == Bstring -> production_vertex() ) 
-      return Error( "Bstring particle has no production vertex." ) ;
-  
-    // create a new vertex and a new HepMC Particle for the root particle
-    // (a copy of which will be associated to the new HepMC event) 
-    
-    HepMC::GenVertex * newVertex =
-      new HepMC::GenVertex( Bstring -> production_vertex() -> position() ) ;
-
-    HepMC::GenEvent * hepMCevt = mcevt -> pGenEvt() ;
-    
-    hepMCevt -> add_vertex( newVertex ) ;
-    
-    HepMC::GenParticle * theNewParticle =
-      new HepMC::GenParticle( Bstring -> momentum() , Bstring -> pdg_id() ,
-                              Bstring -> status() ) ;
-    
-    newVertex -> add_particle_out( theNewParticle ) ;
-    
-    // Associate the new particle to the HepMC event
-    StatusCode sc = fillHepMCEvent( theNewParticle , Bstring ) ;
-    hepMCevt -> set_signal_process_vertex( theNewParticle -> production_vertex() ) ;
-  
-    if ( ! sc.isSuccess( ) ) 
-      return Error( "Could not fill HepMC event for signal tree" , sc ) ;
-                            
-    // Check if container already exists
-    if ( exist< LHCb::HepMCEvents >( m_outputHepMCEvent ) ) 
-      return Error( "B string container already exists !" ) ;
-  
-    LHCb::HepMCEvents * hepVect = new LHCb::HepMCEvents ;
-    hepVect -> insert( mcevt ) ;
-    
-    // Register new location and store HepMC event
-    put( hepVect , m_outputHepMCEvent ) ;
-    
-    return sc ;
-  }
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Fill HepMC event from a HepMC tree
-//=============================================================================
-StatusCode SaveSignalBInformation::fillHepMCEvent( HepMC::GenParticle * 
-                                                   theNewParticle ,
-                                                   const HepMC::GenParticle * 
-                                                   theOldParticle ) 
-  const {
-  StatusCode sc = StatusCode::SUCCESS ;
-  //
-  // Copy theOldParticle to theNewParticle in theEvent
-  // theNewParticle already exist and is created outside this function
-  HepMC::GenVertex * oVertex = theOldParticle -> end_vertex() ;
-  if ( 0 != oVertex ) {
-    // Create decay vertex and associate it to theNewParticle
-    HepMC::GenVertex * newVertex =
-      new HepMC::GenVertex( oVertex -> position() ) ;
-    newVertex -> add_particle_in( theNewParticle ) ;
-    theNewParticle -> parent_event() -> add_vertex( newVertex ) ;
-
-    // loop over child particle of this vertex after sorting them
-    std::list< const HepMC::GenParticle * > outParticles ;
-    for ( HepMC::GenVertex::particles_out_const_iterator itP = 
-            oVertex -> particles_out_const_begin() ; 
-          itP != oVertex -> particles_out_const_end() ; ++itP )
-      outParticles.push_back( (*itP ) ) ;
-
-    outParticles.sort( HepMCUtils::compareHepMCParticles ) ;
-
-    std::list< const HepMC::GenParticle * >::const_iterator child ;
-    for ( child = outParticles.begin( ) ; child != outParticles.end( ) ; 
-          ++child ) {
-      
-      // Create a new particle for each daughter of theOldParticle
-      HepMC::GenParticle * newPart =
-        new HepMC::GenParticle ( (*child) -> momentum () ,
-                                 (*child) -> pdg_id ()   ,
-                                 (*child) -> status ()   ) ;
-      newVertex -> add_particle_out( newPart ) ;
-      
-      const HepMC::GenParticle * theChild = (*child) ;
-      // Recursive call : fill the event with the daughters
-      sc = fillHepMCEvent( newPart , theChild ) ;
-      
-      if ( ! sc.isSuccess() ) return sc ;
-    }
-  }
-  return sc ;
-}
diff --git a/Gen/Generators/src/component/SaveSignalBInformation.h b/Gen/Generators/src/component/SaveSignalBInformation.h
deleted file mode 100644
index f17e259bffe103a24d72b1f7ada9a1d5430c134f..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SaveSignalBInformation.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef COMPONENT_SAVESIGNALBINFORMATION_H
-#define COMPONENT_SAVESIGNALBINFORMATION_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-// forward declarations
-namespace HepMC {
-  class GenVertex ;
-  class GenParticle ;
-}
-
-/** @class SaveSignalBInformation SaveSignalBInformation.h
- *
- *  Algorithm that takes the b string information from HepMC
- *  and stores it at a specific location
- *
- *  @author Patrick Robbe
- *  @date   2013-06-26
- */
-class SaveSignalBInformation : public GaudiAlgorithm {
-public:
-  /// Standard constructor
-  SaveSignalBInformation( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~SaveSignalBInformation( ) { } ; ///< Destructor
-
-  StatusCode execute   () override;    ///< Algorithm execution
-
-protected:
-
-private:
-  /// Extract B string from signal
-  StatusCode extractSignal( const HepMC::GenVertex * theVertex ) const ;
-
-  /// make a new HepMC event
-  StatusCode fillHepMCEvent( HepMC::GenParticle * theNewParticle,
-                             const HepMC::GenParticle * theOldParticle )
-    const ;
-
-  std::string m_inputHepMCEvent  ;
-  std::string m_outputHepMCEvent ;
-};
-#endif // COMPONENT_SAVESIGNALBINFORMATION_H
diff --git a/Gen/Generators/src/component/SignalForcedFragmentation.cpp b/Gen/Generators/src/component/SignalForcedFragmentation.cpp
deleted file mode 100755
index 91e84cd4f09a643e137caa35436655cb572efd28..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalForcedFragmentation.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-// $Id: SignalForcedFragmentation.cpp,v 1.15 2008-07-24 22:05:38 robbep Exp $
-// Include files
-
-// from Gaudi
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-#include "GaudiKernel/SystemOfUnits.h"
-#include "GaudiKernel/PhysicalConstants.h"
-
-// from HepMC
-#include "HepMC/GenEvent.h"
-
-// from Kernel
-#include "MCInterfaces/IGenCutTool.h"
-#include "MCInterfaces/IDecayTool.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "GenEvent/HepMCUtils.h"
-
-// from Event
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// local
-#include "SignalForcedFragmentation.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : SignalForcedFragmentation
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( SignalForcedFragmentation )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-SignalForcedFragmentation::SignalForcedFragmentation(
-  const std::string& type, const std::string& name, const IInterface* parent )
-  : Signal( type, name , parent ) , m_signalMass( 0. ) {
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-SignalForcedFragmentation::~SignalForcedFragmentation( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode SignalForcedFragmentation::initialize( ) {
-  StatusCode sc = Signal::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  LHCb::IParticlePropertySvc * ppSvc =
-    svc< LHCb::IParticlePropertySvc >( "LHCb::ParticlePropertySvc" ) ;
-  const LHCb::ParticleProperty * prop = ppSvc -> find( LHCb::ParticleID( *m_pids.begin() ) ) ;
-  m_signalMass = prop -> mass() ;
-
-  release( ppSvc ) ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Generate set of events with repeated hadronization
-//=============================================================================
-bool SignalForcedFragmentation::generate( const unsigned int nPileUp ,
-                                          LHCb::HepMCEvents * theEvents ,
-                                          LHCb::GenCollisions * theCollisions )
-{
-  StatusCode sc ;
-
-  // first decay signal particle
-  HepMC::GenEvent * theSignalHepMCEvent = new HepMC::GenEvent( ) ;
-  HepMC::GenParticle * theSignalAtRest = new HepMC::GenParticle( ) ;
-  theSignalAtRest ->
-    set_momentum( HepMC::FourVector( 0., 0., 0., m_signalMass ) ) ;
-
-  // Memorize if signal has been inverted (not used here)
-  bool isInverted = false ;
-  bool dummyHasFlipped = false ;
-  bool hasFailed = false ;
-
-  // Create an origin vertex at (0,0,0,0) for the signal particle at rest
-  HepMC::GenVertex * theVertex =
-    new HepMC::GenVertex( HepMC::FourVector( 0., 0., 0., 0. ) ) ;
-  theSignalHepMCEvent -> add_vertex( theVertex ) ;
-  theVertex -> add_particle_out( theSignalAtRest ) ;
-
-  bool flip ;
-  int theSignalPID = *m_pids.begin() ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  if ( m_cpMixture ) {
-    // decide which flavour to generate :
-    // if flavour < 0.5, b flavour
-    // if flavour >= 0.5, bbar flavour
-    double flavour = m_flatGenerator() ;
-
-    m_decayTool -> enableFlip() ;
-
-    if ( flavour < 0.5 )
-      theSignalAtRest -> set_pdg_id( +abs( theSignalPID ) ) ;
-    else
-      theSignalAtRest -> set_pdg_id( -abs( theSignalPID ) ) ;
-  } else {
-    // generate only one flavour
-    m_decayTool -> disableFlip() ;
-    theSignalAtRest -> set_pdg_id( theSignalPID ) ;
-  }
-
-  sc = m_decayTool -> generateSignalDecay( theSignalAtRest , flip ) ;
-  if ( ! sc.isSuccess() ) return false ;
-
-  bool result = false ;
-
-  PIDs signalPid ;
-  signalPid.insert( theSignalAtRest -> pdg_id() ) ;
-
-  sc = m_productionTool ->
-    setupForcedFragmentation( theSignalAtRest -> pdg_id() ) ;
-  if ( sc.isFailure() ) error() << "Could not force fragmentation" << endmsg ;
-
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-
-  // TODO: fix problem when 2 consecutive B events. The 2 B events both have
-  // signal in them !
-
-  // Then generate set of pile-up events
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent ,
-                        theGenCollision ) ;
-
-    sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-    if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-
-    if ( ! result ) {
-      ParticleVector theParticleList ;
-      if ( checkPresence( signalPid , theGenEvent , theParticleList ) ) {
-        m_nEventsBeforeCut++ ;
-        key = LHCb::GenCountersFSR::BeforeLevelCut;
-        if(genFSR) genFSR->incrementGenCounter(key, 1);
-
-        updateCounters( theParticleList , m_nParticlesBeforeCut ,
-                        m_nAntiParticlesBeforeCut , false , false ) ;
-
-        HepMC::GenParticle * theSignal = chooseAndRevert( theParticleList ,
-                                                          isInverted ,
-                                                          dummyHasFlipped ,
-							  hasFailed ) ;
-
-        // Erase daughters of signal particle
-        HepMCUtils::RemoveDaughters( theSignal ) ;
-
-	if ( hasFailed ) {
-	  Error( "Skip event" ) ;
-	  return false  ;
-	}
-
-        theParticleList.clear() ;
-        theParticleList.push_back( theSignal ) ;
-
-        // Now boost signal at rest to frame of signal produced by
-        // production generator
-        Gaudi::LorentzVector mom( theSignal -> momentum() ) ;
-        ROOT::Math::Boost theBoost( -mom.BoostToCM() ) ;
-
-        // Give signal status
-        theSignal -> set_status( LHCb::HepMCEvent::SignalInLabFrame ) ;
-
-        sc = boostTree( theSignal , theSignalAtRest , theBoost ) ;
-        if ( ! sc.isSuccess() ) Exception( "Cannot boost signal tree" ) ;
-
-        bool passCut = true ;
-        if ( 0 != m_cutTool )
-          passCut = m_cutTool -> applyCut( theParticleList , theGenEvent ,
-                                           theGenCollision ) ;
-
-        if ( passCut && ( ! theParticleList.empty() ) ) {
-          m_nEventsAfterCut++ ;
-
-          updateCounters( theParticleList , m_nParticlesAfterCut ,
-                          m_nAntiParticlesAfterCut , true , false ) ;
-
-          if ( isInverted ) {
-            ++m_nInvertedEvents ;
-            key = LHCb::GenCountersFSR::EvtInverted;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-          else
-          {
-            key = LHCb::GenCountersFSR::AfterLevelCut;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-
-          if ( m_cleanEvents ) {
-            sc = isolateSignal( theSignal ) ;
-            if ( ! sc.isSuccess() ) Exception( "Cannot isolate signal" ) ;
-          }
-
-          theGenEvent ->
-            set_signal_process_vertex( theSignal -> end_vertex() ) ;
-          theGenCollision -> setIsSignal( true ) ;
-
-          // Count signal B and signal Bbar
-          if ( theSignal -> pdg_id() > 0 ) {
-            ++m_nSig ;
-            key = LHCb::GenCountersFSR::EvtSignal;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-          else
-          {
-            ++m_nSigBar ;
-            key = LHCb::GenCountersFSR::EvtantiSignal;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-          }
-
-          // Update counters
-          GenCounters::updateHadronCounters( theGenEvent , m_bHadC ,
-                                             m_antibHadC , m_cHadC ,
-                                             m_anticHadC , m_bbCounter ,
-                                             m_ccCounter ) ;
-          GenCounters::updateExcitedStatesCounters( theGenEvent ,
-                                                    m_bExcitedC ,
-                                                    m_cExcitedC ) ;
-
-          if(genFSR) GenCounters::updateHadronFSR( theGenEvent, genFSR, "Acc");
-
-          result = true ;
-        }
-      }
-    }
-  }
-
-  delete theSignalHepMCEvent ;
-  return result ;
-}
-
-//=============================================================================
-// Boost the Tree theSignal to theVector frame and attach it to theMother
-//=============================================================================
-StatusCode SignalForcedFragmentation::boostTree( HepMC::GenParticle *
-                                                 theSignal ,
-                                                 const HepMC::GenParticle *
-                                                 theSignalAtRest ,
-                                                 const ROOT::Math::Boost&
-                                                 theBoost )
-  const {
-  if ( 0 == theSignalAtRest -> end_vertex() ) return StatusCode::SUCCESS ;
-
-  if ( 0 != theSignal -> end_vertex() )
-    return Error( "The particle has already a decay vertex !" ) ;
-
-  if ( 0 == theSignalAtRest -> production_vertex() )
-    return Error( "The particle has no production vertex !" ) ;
-
-  // Displacement in original frame
-  Gaudi::LorentzVector positionEnd , positionBegin ;
-  positionEnd.SetXYZT( theSignalAtRest -> end_vertex() -> position() . x() ,
-                       theSignalAtRest -> end_vertex() -> position() . y() ,
-                       theSignalAtRest -> end_vertex() -> position() . z() ,
-                       theSignalAtRest -> end_vertex() -> position() . t() *
-                       Gaudi::Units::c_light ) ;
-
-  positionBegin.SetXYZT(theSignalAtRest->production_vertex()->position().x() ,
-                        theSignalAtRest->production_vertex()->position().y() ,
-                        theSignalAtRest->production_vertex()->position().z() ,
-                        theSignalAtRest->production_vertex()->position().t()
-                        * Gaudi::Units::c_light ) ;
-
-  Gaudi::LorentzVector position = positionEnd - positionBegin ;
-
-  // Displacement in new frame after boost.
-  Gaudi::LorentzVector newPosition = theBoost( position ) ;
-
-  // LHCb Units
-  Gaudi::LorentzVector newP ;
-  newP.SetXYZT( newPosition.X() , newPosition.Y() , newPosition.Z() ,
-                newPosition.T() / Gaudi::Units::c_light ) ;
-
-  // Add original position
-  Gaudi::LorentzVector
-    originalPosition( theSignal -> production_vertex() -> position() ) ;
-  newP += originalPosition ;
-
-  // Create new HepMC vertex after boost and add it to the current event
-  HepMC::GenVertex * newVertex =
-    new HepMC::GenVertex( HepMC::FourVector(newP.X(), newP.Y() , newP.Z() ,
-                                            newP.T()));
-
-  theSignal -> parent_event() -> add_vertex( newVertex ) ;
-  newVertex -> add_particle_in( theSignal ) ;
-
-  HepMC::GenVertex * sVertex = theSignalAtRest -> end_vertex() ;
-
-  HepMC::GenVertex::particles_out_const_iterator child ;
-
-  for ( child  = sVertex -> particles_out_const_begin( ) ;
-        child != sVertex -> particles_out_const_end( ) ; ++child ) {
-    // Boost all daughter particles and create a new HepMC particle
-    // for each daughter
-    Gaudi::LorentzVector momentum( (*child) -> momentum() ) ;
-    Gaudi::LorentzVector newMomentum = theBoost( momentum ) ;
-    int id                           = (*child) -> pdg_id() ;
-    int status                       = (*child) -> status() ;
-
-    HepMC::GenParticle * newPart =
-      new HepMC::GenParticle( HepMC::FourVector( newMomentum.Px() ,
-                                                 newMomentum.Py() ,
-                                                 newMomentum.Pz() ,
-                                                 newMomentum.E()   ) ,
-                              id , status ) ;
-
-    newVertex -> add_particle_out( newPart ) ;
-
-    HepMC::GenParticle * theNewSignal             = newPart ;
-    const HepMC::GenParticle * theNewSignalAtRest = (*child) ;
-
-    // Recursive call to boostTree for each daughter
-    boostTree( theNewSignal , theNewSignalAtRest , theBoost ) ;
-  }
-
-  return StatusCode::SUCCESS ;
-}
diff --git a/Gen/Generators/src/component/SignalForcedFragmentation.h b/Gen/Generators/src/component/SignalForcedFragmentation.h
deleted file mode 100755
index 6f160fdf1d04467df2b4f7a1bc8fbe9ac6d3d0ac..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalForcedFragmentation.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id: SignalForcedFragmentation.h,v 1.6 2008-05-29 14:22:00 gcorti Exp $
-#ifndef GENERATORS_SIGNALFORCEDFRAGMENTATION_H
-#define GENERATORS_SIGNALFORCEDFRAGMENTATION_H 1
-
-// Include files
-#include "Generators/Signal.h"
-#include "GaudiKernel/Transform4DTypes.h"
-#include "GaudiKernel/Vector4DTypes.h"
-
-/** @class SignalForcedFragmentation SignalForcedFragmentation.h "SignalForcedFragmentation.h"
- *
- *  Tool for signal generation with forced fragmentation.
- *  Concrete implementation of ISampleGenerationTool using
- *  the Signal base class.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class SignalForcedFragmentation : public Signal {
- public:
-  /// Standard constructor
-  SignalForcedFragmentation( const std::string & type ,
-                             const std::string & name ,
-                             const IInterface * parent ) ;
-
-  virtual ~SignalForcedFragmentation( ); ///< Destructor
-
-  StatusCode initialize( ) override; ///< Initialize
-
-  /** Generate set of interactions.
-   *  Implements ISampleGenerationTool::generate
-   *  -# Choose randomly a flavour to generate for each event
-   *  -# Generate with the IDecayTool the signal event (at rest)
-   *     of this flavour.
-   *  -# Force the fragmentation into this flavour when an
-   *     interaction contains a b quark, calling
-   *     IProductionTool::setupForcedFragmentation.
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
- private:
-  /** Boost a particle at rest in the lab frame.
-   *  @param[in,out] theSignal       Particle in the lab. frame
-   *                                 to boost to
-   *  @param[in]     theSignalAtRest Decay tree at rest to boost
-   *  @param[in]     theVector       3-momentum boost vector
-   */
-  StatusCode boostTree( HepMC::GenParticle * theSignal ,
-                        const HepMC::GenParticle * theSignalAtRest ,
-                        const ROOT::Math::Boost & theBoost ) const ;
-
-  double m_signalMass ; ///< Mass of the signal particle
-};
-
-
-#endif // GENERATORS_SIGNALFORCEDFRAGMENTATION_H
diff --git a/Gen/Generators/src/component/SignalPlain.cpp b/Gen/Generators/src/component/SignalPlain.cpp
deleted file mode 100755
index 133b5c103e69f9eb6767545bc0b7f3e8f0a27325..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalPlain.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// Include files
-
-// local
-#include "SignalPlain.h"
-
-// from Gaudi
-
-// Event
-#include "Event/HepMCEvent.h"
-#include "Event/GenCollision.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// Kernel
-#include "MCInterfaces/IGenCutTool.h"
-#include "MCInterfaces/IDecayTool.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "GenEvent/HepMCUtils.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : SignalPlain
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( SignalPlain )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-SignalPlain::SignalPlain( const std::string& type, const std::string& name,
-                          const IInterface* parent )
-  : Signal( type, name , parent ) { ; }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-SignalPlain::~SignalPlain( ) { ; }
-
-//=============================================================================
-// Generate Set of Event for Minimum Bias event type
-//=============================================================================
-bool SignalPlain::generate( const unsigned int nPileUp ,
-                            LHCb::HepMCEvents * theEvents ,
-                            LHCb::GenCollisions * theCollisions ) {
-  StatusCode sc ;
-  bool result = false ;
-  // Memorize if the particle is inverted
-  bool isInverted = false ;
-  bool hasFlipped = false ;
-  bool hasFailed = false ;
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent,
-                        theGenCollision ) ;
-
-    sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-    if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-
-    if ( ! result ) {
-      // Decay particles heavier than the particles to look at
-      decayHeavyParticles( theGenEvent , m_signalQuark , m_signalPID ) ;
-
-      // Check if one particle of the requested list is present in event
-      ParticleVector theParticleList ;
-      if ( checkPresence( m_pids , theGenEvent , theParticleList ) ) {
-
-        // establish correct multiplicity of signal
-        if ( ensureMultiplicity( theParticleList.size() ) ) {
-
-          // choose randomly one particle and force the decay
-          hasFlipped = false ;
-          isInverted = false ;
-          hasFailed  = false ;
-          HepMC::GenParticle * theSignal =
-            chooseAndRevert( theParticleList , isInverted , hasFlipped , hasFailed ) ;
-          if ( hasFailed ) {
-            HepMCUtils::RemoveDaughters( theSignal ) ;
-            Error( "Skip event" ) ;
-            return false ;
-          }
-
-          theParticleList.clear() ;
-          theParticleList.push_back( theSignal ) ;
-
-          if ( ! hasFlipped ) {
-
-            m_nEventsBeforeCut++ ;
-            key = LHCb::GenCountersFSR::BeforeLevelCut;
-            if(genFSR) genFSR->incrementGenCounter(key, 1);
-
-            // count particles in 4pi
-            updateCounters( theParticleList , m_nParticlesBeforeCut ,
-                            m_nAntiParticlesBeforeCut , false , false ) ;
-
-            bool passCut = true ;
-            if ( 0 != m_cutTool )
-              passCut = m_cutTool -> applyCut( theParticleList , theGenEvent ,
-                                               theGenCollision ) ;
-
-            if ( passCut && ( ! theParticleList.empty() ) ) {
-              if ( ! isInverted ) {
-                m_nEventsAfterCut++ ;
-                key = LHCb::GenCountersFSR::AfterLevelCut;
-                if(genFSR) genFSR->incrementGenCounter(key, 1);
-              }
-
-              if ( isInverted ) {
-                ++m_nInvertedEvents ;
-                key = LHCb::GenCountersFSR::EvtInverted;
-                if(genFSR) genFSR->incrementGenCounter(key, 1);
-              }
-
-              // Count particles passing the generator level cut with pz > 0
-              updateCounters( theParticleList , m_nParticlesAfterCut ,
-                              m_nAntiParticlesAfterCut , true , isInverted ) ;
-
-              if ( m_cleanEvents ) {
-                sc = isolateSignal( theSignal ) ;
-                if ( ! sc.isSuccess() ) Exception( "Cannot isolate signal" ) ;
-              }
-              theGenEvent ->
-                set_signal_process_vertex( theSignal -> end_vertex() ) ;
-
-              theGenCollision -> setIsSignal( true ) ;
-
-              // Count signal B and signal Bbar
-              if ( theSignal -> pdg_id() > 0 ) {
-                ++m_nSig ;
-                key = LHCb::GenCountersFSR::EvtSignal;
-                if(genFSR) genFSR->incrementGenCounter(key, 1);
-              }
-              else {
-                ++m_nSigBar ;
-                key = LHCb::GenCountersFSR::EvtantiSignal;
-                if(genFSR) genFSR->incrementGenCounter(key, 1);
-              }
-
-
-              // Update counters
-              GenCounters::updateHadronCounters( theGenEvent , m_bHadC ,
-                                                 m_antibHadC , m_cHadC ,
-                                                 m_anticHadC , m_bbCounter ,
-                                                 m_ccCounter ) ;
-              GenCounters::updateExcitedStatesCounters( theGenEvent ,
-                                                        m_bExcitedC ,
-                                                        m_cExcitedC ) ;
-
-              if(genFSR) GenCounters::updateHadronFSR( theGenEvent, genFSR, "Acc");
-
-
-              result = true ;
-            } else {
-              // event does not pass cuts
-              HepMCUtils::RemoveDaughters( theSignal ) ;
-            }
-          } else {
-            // has flipped:
-            HepMCUtils::RemoveDaughters( theSignal ) ;
-            theSignal -> set_pdg_id( - ( theSignal -> pdg_id() ) ) ;
-          }
-        }
-      }
-    }
-  }
-
-  return result ;
-}
-
diff --git a/Gen/Generators/src/component/SignalPlain.h b/Gen/Generators/src/component/SignalPlain.h
deleted file mode 100755
index 76fab6097655510d41fce4c117c9daa7754510e7..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalPlain.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// $Id: SignalPlain.h,v 1.5 2006-10-01 22:43:40 robbep Exp $
-#ifndef GENERATORS_SIGNALPLAIN_H
-#define GENERATORS_SIGNALPLAIN_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-
-#include "Generators/Signal.h"
-
-/** @class SignalPlain SignalPlain.h
- *
- *  Tool for signal generation with plain method. Concrete
- *  implementation of ISampleGenerationTool using the Signal
- *  base class.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class SignalPlain : public Signal {
- public:
-  /// Standard constructor
-  SignalPlain( const std::string & type , const std::string & name ,
-               const IInterface * parent ) ;
-
-  virtual ~SignalPlain( ); ///< Destructor
-
-  /** Generates events containing a signal particle.
-   *  Implements ISampleProductionTool::generate.
-   *  Loop over events until it contains a signal particle
-   *  without using any trick (just like Inclusive).
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
- private:
-};
-#endif // GENERATORS_SIGNALPLAIN_H
diff --git a/Gen/Generators/src/component/SignalRepeatedHadronization.cpp b/Gen/Generators/src/component/SignalRepeatedHadronization.cpp
deleted file mode 100755
index ddca9559145ad02aecddeb8109fc9a1d495bf94a..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalRepeatedHadronization.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-// $Id: SignalRepeatedHadronization.cpp,v 1.14 2007-02-22 13:30:24 robbep Exp $
-// Include files
-
-// local
-#include "SignalRepeatedHadronization.h"
-
-// from Gaudi
-
-// from Kernel
-#include "Kernel/ParticleID.h"
-#include "MCInterfaces/IGenCutTool.h"
-#include "MCInterfaces/IDecayTool.h"
-
-// From HepMC
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenEvent.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "GenEvent/HepMCUtils.h"
-
-// from Event
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : SignalRepeatedHadronization
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( SignalRepeatedHadronization )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-SignalRepeatedHadronization::SignalRepeatedHadronization(
-  const std::string& type, const std::string& name, const IInterface* parent )
-  : Signal( type, name , parent ) {
-    declareProperty( "MaxNumberOfRepetitions" ,
-                     m_maxNumberOfRepetitions = 500 ) ;
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-SignalRepeatedHadronization::~SignalRepeatedHadronization( ) { ; }
-
-//=============================================================================
-// Initialize Method
-//=============================================================================
-StatusCode SignalRepeatedHadronization::initialize( ) {
-  StatusCode sc = Signal::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Determine quark types
-  LHCb::ParticleID pid( *m_pids.begin() ) ;
-  if ( pid.hasBottom() ) {
-    m_pidQuarks.insert( -LHCb::ParticleID::bottom ) ;
-    m_pidQuarks.insert( LHCb::ParticleID::bottom ) ;
-  } else if ( pid.hasCharm() ) {
-    m_pidQuarks.insert( -LHCb::ParticleID::charm ) ;
-    m_pidQuarks.insert( LHCb::ParticleID::charm ) ;
-  }
-
-  return sc ;
-}
-
-//=============================================================================
-// Generate Set of Event for Minimum Bias event type
-//=============================================================================
-bool SignalRepeatedHadronization::generate( const unsigned int nPileUp ,
-                                            LHCb::HepMCEvents * theEvents ,
-                                            LHCb::GenCollisions *
-                                            theCollisions ) {
-  StatusCode sc ;
-  bool gotSignalInteraction = false ;
-
-  // Memorize the inversion of the event
-  bool isInverted = false ;
-
-  // Memorize the flip of the event
-  bool hasFlipped = false ;
-
-  // Check if problem in EvtGen
-  bool hasFailed = false ;
-
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-  HepMC::GenParticle * theSignal ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    bool partonEventWithSignalQuarks = false ;
-    ParticleVector theQuarkList ;
-
-    prepareInteraction( theEvents , theCollisions , theGenEvent ,
-                        theGenCollision ) ;
-
-    if ( ! gotSignalInteraction ) m_productionTool -> turnOffFragmentation( ) ;
-
-    if (i==0 && ! gotSignalInteraction) theGenCollision -> setIsSignal( true ) ;
-
-    sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-
-    if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-
-    if ( ! gotSignalInteraction ) {
-      if ( checkPresence( m_pidQuarks , theGenEvent , theQuarkList ) ) {
-        partonEventWithSignalQuarks = true ;
-        m_productionTool -> savePartonEvent( theGenEvent ) ;
-      }
-
-      m_productionTool -> turnOnFragmentation( ) ;
-      // Clear theGenEvent
-      Clear( theGenEvent ) ;
-      m_productionTool -> hadronize( theGenEvent , theGenCollision ) ;
-
-      // Check if one particle of the requested list is present in event
-      unsigned int nRepetitions = 0 ;
-
-      while ( nRepetitions < m_maxNumberOfRepetitions ) {
-        // Decay heavy particles
-        decayHeavyParticles( theGenEvent , m_signalQuark , m_signalPID ) ;
-
-        // Check if one particle of the requested list is present in event
-        ParticleVector theParticleList ;
-
-        if ( checkPresence( m_pids , theGenEvent , theParticleList ) ) {
-
-          // establish correct multiplicity of signal
-          if ( ensureMultiplicity( theParticleList.size() ) ) {
-
-            // If there are several particles passing the cuts, choose one
-            // and revert event if it has pz < 0
-            // memorize that the event is inverted in isInverted
-            // and force the decay at the same time
-            isInverted = false ;
-            hasFlipped = false ;
-	    hasFailed  = false ;
-            theSignal = chooseAndRevert( theParticleList , isInverted ,
-                                         hasFlipped , hasFailed ) ;
-
-	    if ( hasFailed ) {
-	      Error( "Skip Event" ) ;
-	      HepMCUtils::RemoveDaughters( theSignal ) ;
-	      return false ;
-	    }
-
-            theParticleList.clear() ;
-            theParticleList.push_back( theSignal ) ;
-
-            // Remove events with flip due to CP violation
-            if ( ! hasFlipped ) {
-
-              // Count particles and anti-particles of Signal type before
-              // the cut in all directions
-              m_nEventsBeforeCut++ ;
-              key = LHCb::GenCountersFSR::BeforeLevelCut;
-              if(genFSR) genFSR->incrementGenCounter(key, 1);
-
-              updateCounters( theParticleList , m_nParticlesBeforeCut ,
-                              m_nAntiParticlesBeforeCut , false , false ) ;
-
-              bool passCut = true ;
-
-              if ( 0 != m_cutTool )
-                passCut = m_cutTool -> applyCut( theParticleList , theGenEvent ,
-                                                 theGenCollision ) ;
-
-              if ( passCut && ( ! theParticleList.empty() ) ) {
-
-                if ( ! isInverted ) {
-                  m_nEventsAfterCut++ ;
-                  key = LHCb::GenCountersFSR::AfterLevelCut;
-                  if(genFSR) genFSR->incrementGenCounter(key, 1);
-                }
-
-                if ( isInverted ) {
-                  ++m_nInvertedEvents ;
-                  key = LHCb::GenCountersFSR::EvtInverted;
-                  if(genFSR) genFSR->incrementGenCounter(key, 1);
-                }
-
-                // Count particles and anti-particles of Signal type with
-                // pz>0, after generator level cut
-                updateCounters( theParticleList , m_nParticlesAfterCut ,
-                                m_nAntiParticlesAfterCut , true ,
-                                isInverted ) ;
-
-                gotSignalInteraction = true ;
-                if ( m_cleanEvents ) {
-                  sc = isolateSignal( theSignal ) ;
-                  if ( ! sc.isSuccess() )
-                    Exception( "Cannot isolate signal" ) ;
-                }
-
-                theGenEvent ->
-                  set_signal_process_vertex( theSignal -> end_vertex() ) ;
-
-                // theGenCollision -> setIsSignal( true ) ;
-
-                if ( theSignal -> pdg_id() > 0 ) {
-                  ++m_nSig ;
-                  key = LHCb::GenCountersFSR::EvtSignal;
-                  if(genFSR) genFSR->incrementGenCounter(key, 1);
-                }
-                else {
-                  ++m_nSigBar ;
-                  key = LHCb::GenCountersFSR::EvtantiSignal;
-                  if(genFSR) genFSR->incrementGenCounter(key, 1);
-                }
-
-                // Update counters
-                GenCounters::updateHadronCounters( theGenEvent , m_bHadC ,
-                                                   m_antibHadC , m_cHadC ,
-                                                   m_anticHadC , m_bbCounter,
-                                                   m_ccCounter ) ;
-                GenCounters::updateExcitedStatesCounters( theGenEvent ,
-                                                          m_bExcitedC ,
-                                                          m_cExcitedC ) ;
-                if(genFSR) GenCounters::updateHadronFSR( theGenEvent, genFSR, "Acc");
-              }
-              else {
-                // Signal does not pass cut: remove daughters
-                HepMCUtils::RemoveDaughters( theSignal ) ;
-              }
-            } else {
-              // event has flipped: remove daughters of signal and revert PID
-              HepMCUtils::RemoveDaughters( theSignal ) ;
-              theSignal -> set_pdg_id( - ( theSignal -> pdg_id() ) ) ;
-            }
-          }
-
-          // if the interaction is not kept, we must re-hadronize it
-          // once to have a fresh unbiased event
-          if ( ! gotSignalInteraction ) {
-            nRepetitions++ ;
-            m_productionTool -> retrievePartonEvent( theGenEvent ) ;
-            m_productionTool -> turnOnFragmentation( ) ;
-            m_productionTool -> savePartonEvent( theGenEvent ) ;
-            Clear( theGenEvent ) ;
-            m_productionTool -> hadronize( theGenEvent , theGenCollision ) ;
-          }
-          // Then we exit and do not re-hadronize this event
-          // not to bias things
-          break ;
-        }
-
-        if ( ! partonEventWithSignalQuarks ) break ;
-
-        nRepetitions++ ;
-        m_productionTool -> retrievePartonEvent( theGenEvent ) ;
-        m_productionTool -> turnOnFragmentation( ) ;
-        m_productionTool -> savePartonEvent( theGenEvent ) ;
-        // Clear HepMC event
-        Clear( theGenEvent ) ;
-        m_productionTool -> hadronize( theGenEvent , theGenCollision ) ;
-      }
-
-      if ( nRepetitions == m_maxNumberOfRepetitions )
-        info() << "Number of repetitions of hadronization exceeds the limit"
-               << endmsg ;
-    }
-    else if (m_hepMCName=="Pythia8") {
-      //hadronize the pile-up events for Pythia8 (already done above for pythia6)
-      m_productionTool -> hadronize( theGenEvent , theGenCollision ) ;
-    }
-  }
-
-  return gotSignalInteraction ;
-}
-
-//=============================================================================
-// Clear a complete HepMC event
-//=============================================================================
-void SignalRepeatedHadronization::Clear( HepMC::GenEvent * theEvent ) const {
-  if ( ! theEvent -> vertices_empty() ) {
-    std::vector< HepMC::GenVertex * > tempList( theEvent -> vertices_begin() ,
-                                                theEvent -> vertices_end() ) ;
-    std::vector< HepMC::GenVertex * >::iterator iter ;
-    for ( iter = tempList.begin() ; iter != tempList.end() ; ++iter ) {
-      if ( ! theEvent -> remove_vertex( *iter ) )
-        Exception( "Could not remove vertex !" ) ;
-      delete (*iter) ;
-    }
-  }
-}
diff --git a/Gen/Generators/src/component/SignalRepeatedHadronization.h b/Gen/Generators/src/component/SignalRepeatedHadronization.h
deleted file mode 100755
index 2cd618fc89991f03bdc51f93a4f642549badd175..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/SignalRepeatedHadronization.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// $Id: SignalRepeatedHadronization.h,v 1.6 2005-12-31 17:33:12 robbep Exp $
-#ifndef GENERATORS_SIGNALREPEATEDHADRONIZATION_H
-#define GENERATORS_SIGNALREPEATEDHADRONIZATION_H 1
-
-// Include files
-#include "Generators/Signal.h"
-
-/** @class SignalRepeatedHadronization SignalRepeatedHadronization.h "SignalRepeatedHadronization.h"
- *
- *  Tool for signal generation with repeated hadronization method.
- *  Concrete implementation of ISampleGenerationTool using the
- *  Signal base class.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-18
- */
-class SignalRepeatedHadronization : public Signal {
-public:
-  /// Standard constructor
-  SignalRepeatedHadronization( const std::string& type,
-                               const std::string& name,
-                               const IInterface* parent);
-
-  virtual ~SignalRepeatedHadronization( ); ///< Destructor
-
-  StatusCode initialize( ) override; ///< Initialize
-
-  /** Generate events with at least one interaction containing the signal
-   *  Implements ISampleGenerationTool::generate.
-   *  -# Turn off hadronization process (using
-   *     IProductionTool::turnOffFragmentation)
-   *  -# Generate interaction with IProductionTool
-   *  -# If event has a b quark, save parton event (using
-   *     IProductionTool::savePartonEvent
-   *  -# In all cases, hadronize the event (using
-   *     IProductionTool::hadronize.
-   *  -# If interaction has b quark, recall (using
-   *     IProductionTool::retrievePartonEvent) and
-   *     hadronize this event (with IProductionTool:hadronize)
-   *     until it contains a signal B.
-   *  -# Apply generator level cut and keep or reject full
-   *     event (if rejected, the interaction is not hadronized
-   *     again and is not kept).
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-protected:
-  /// Delete full content of an event
-  void Clear( HepMC::GenEvent * theEvent ) const ;
-
-private:
-  /// Maximum number of allowed repetitions of hadronization (set by options)
-  unsigned int  m_maxNumberOfRepetitions ;
-
-  /// List of quarks of signal particles to generate
-  PIDs          m_pidQuarks        ;
-};
-#endif // GENERATORS_SIGNALREPEATEDHADRONIZATION_H
diff --git a/Gen/Generators/src/component/Special.cpp b/Gen/Generators/src/component/Special.cpp
deleted file mode 100755
index 63b0bc05b04b9b268854e37f64a890b3fa098f3e..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Special.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-// $Id: Special.cpp,v 1.13 2009-09-20 17:53:02 robbep Exp $
-// Include files
-
-// local
-#include "Special.h"
-// from Gaudi
-// from Kernel
-#include "MCInterfaces/IGenCutTool.h"
-
-// from Generators
-#include "Generators/IProductionTool.h"
-#include "Generators/GenCounters.h"
-#include "Generators/LhaPdf.h"
-#include "Generators/ICounterLogFile.h"
-
-// Event
-#include "Event/HepMCEvent.h"
-#include "Event/GenCollision.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : Special
-//
-// 2005-08-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( Special )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-Special::Special( const std::string & type , const std::string & name ,
-                  const IInterface * parent )
-  : ExternalGenerator( type, name , parent ) ,
-    m_xmlLogTool( 0 ) ,
-    m_nEventsBeforeCut    (  0 ) ,
-    m_nEventsAfterCut     (  0 ) ,
-    m_maxInteractions     ( 30 ) ,
-    m_pileUpProductionTool(  0 ) {
-  declareProperty( "PileUpProductionTool" ,
-                   m_pileUpProductionToolName =
-                   "Pythia8Production/MinimumBiasPythia8Production" ) ;
-  declareProperty( "ReinitializePileUpGenerator" ,
-                   m_reinitialize = true ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-Special::~Special( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode Special::initialize( ) {
-  info() << "Generating Special events." << endmsg ;
-  StatusCode sc = ExternalGenerator::initialize( ) ;
-
-  // Initialize XML Log file
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  // Switch off LHA print out first
-  if ( msgLevel( MSG::DEBUG ) ) {
-    LhaPdf::lhacontrol().setlhaparm( 19 , "DEBUG" ) ;
-  }
-  else {
-    LhaPdf::lhacontrol().setlhaparm( 19 , "SILENT" ) ;
-  }
-
-  m_pileUpEventsVector.clear() ;
-  m_pileUpCollisionsVector.clear() ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode Special::finalize( ) {
-  std::vector< HepMC::GenEvent * >::iterator iter ;
-  for ( iter = m_pileUpEventsVector.begin() ;
-        iter != m_pileUpEventsVector.end() ; ++iter )
-    delete (*iter) ;
-  m_pileUpEventsVector.clear() ;
-
-  std::vector< LHCb::GenCollision * >::iterator iterC ;
-  for ( iterC = m_pileUpCollisionsVector.begin() ;
-        iterC != m_pileUpCollisionsVector.end() ; ++iterC )
-    delete (*iterC) ;
-  m_pileUpCollisionsVector.clear() ;
-
-  if ( 0 != m_pileUpProductionTool ) release( m_pileUpProductionTool ) ;
-
-  return ExternalGenerator::finalize() ;
-}
-
-
-//=============================================================================
-// Generate Set of Event for Minimum Bias event type
-//=============================================================================
-bool Special::generate( const unsigned int nPileUp ,
-                        LHCb::HepMCEvents * theEvents ,
-                        LHCb::GenCollisions * theCollisions ) {
-  StatusCode sc ;
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-
-  bool result = false ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  // For the moment no pile-up for this type of event
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent,
-                        theGenCollision ) ;
-
-    // First interaction is always "signal"
-
-    if ( 0 == i ) {
-      sc = m_productionTool -> generateEvent( theGenEvent , theGenCollision ) ;
-      if ( sc.isFailure() ) Exception( "Could not generate event" ) ;
-
-      ParticleVector theParticleList ;
-      m_nEventsBeforeCut++ ;
-      key = LHCb::GenCountersFSR::BeforeLevelCut;
-      if(genFSR) genFSR->incrementGenCounter(key, 1);
-
-      bool passCut = true ;
-      if ( 0 != m_cutTool )
-        passCut = m_cutTool -> applyCut( theParticleList , theGenEvent ,
-                                         theGenCollision ) ;
-
-      if ( passCut ) {
-        m_nEventsAfterCut++ ;
-        key = LHCb::GenCountersFSR::AfterLevelCut;
-        if(genFSR) genFSR->incrementGenCounter(key, 1);
-        result = true ;
-        theGenCollision -> setIsSignal( true ) ;
-      } else return false ;
-    } else {
-      // if event passed generator level cut
-      // look if there are still enough pile-up events
-      if ( m_pileUpEventsVector.empty() ) generatePileUp() ;
-
-      // retrieve now pile-up events
-      HepMC::GenEvent * pileUpEvent = m_pileUpEventsVector.back() ;
-      (*theGenEvent) =  ( * pileUpEvent ) ;
-
-      m_pileUpEventsVector.pop_back() ;
-      delete pileUpEvent ;
-
-      // and collision
-      LHCb::GenCollision * pileUpCollision = m_pileUpCollisionsVector.back() ;
-      copyCollision( pileUpCollision , theGenCollision ) ;
-      m_pileUpCollisionsVector.pop_back() ;
-      delete pileUpCollision ;
-    }
-  }
-  return result ;
-}
-
-//=============================================================================
-// Print the counters
-//=============================================================================
-void Special::printCounters( ) const {
-  using namespace GenCounters ;
-  printEfficiency( m_xmlLogTool , "generator level cut" , m_nEventsAfterCut ,
-                   m_nEventsBeforeCut ) ;
-}
-
-//=============================================================================
-// Generate PileUp Minimum Bias interactions
-//=============================================================================
-void Special::generatePileUp() {
-
-  if ( 0 == m_pileUpProductionTool ) {
-    if ( "" != m_pileUpProductionToolName ) {
-      m_pileUpProductionTool =
-        tool< IProductionTool >( m_pileUpProductionToolName , this ) ;
-      m_pileUpProductionTool -> initializeGenerator() ;
-    }
-  }
-
-  if ( 0 == m_pileUpProductionTool ) {
-    fatal() << "No pile up production tool defined !" << endmsg ;
-    return ;
-  }
-
-  // initialize the production tool for pile up generation
-  if ( m_reinitialize )
-    m_pileUpProductionTool -> initializeGenerator() ;
-
-  // generate given number of events
-  for ( unsigned int i = 0 ; i < m_maxInteractions ; ++i ) {
-    HepMC::GenEvent * theEvent = new HepMC::GenEvent ;
-    LHCb::GenCollision * theCollision = new LHCb::GenCollision ;
-    m_pileUpProductionTool -> generateEvent( theEvent ,
-                                             theCollision ) ;
-
-    m_pileUpEventsVector.push_back( theEvent ) ;
-    m_pileUpCollisionsVector.push_back( theCollision ) ;
-  }
-
-  // now initialize the production tool for the "signal"
-  if ( m_reinitialize )
-    m_productionTool -> initializeGenerator() ;
-  //TODO : add finalize function to delete remaining events
-}
-
-//=============================================================================
-// Copy collisions
-//=============================================================================
-void Special::copyCollision( const LHCb::GenCollision * FROM ,
-                             LHCb::GenCollision * TO ) const {
-  TO -> setIsSignal( FROM -> isSignal() ) ;
-  TO -> setProcessType( FROM -> processType() ) ;
-  TO -> setSHat( FROM -> sHat() ) ;
-  TO -> setTHat( FROM -> tHat() ) ;
-  TO -> setUHat( FROM -> uHat() ) ;
-  TO -> setPtHat( FROM -> ptHat() ) ;
-  TO -> setX1Bjorken( FROM -> x1Bjorken() ) ;
-  TO -> setX2Bjorken( FROM -> x2Bjorken() ) ;
-}
diff --git a/Gen/Generators/src/component/Special.h b/Gen/Generators/src/component/Special.h
deleted file mode 100755
index 0e5754d21691a09e3fae5e6eff879ac37f16a5ae..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/Special.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// $Id: Special.h,v 1.5 2007-03-08 13:42:17 robbep Exp $
-#ifndef GENERATORS_SPECIAL_H
-#define GENERATORS_SPECIAL_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "Generators/ExternalGenerator.h"
-
-// forward declarations
-class ICounterLogFile ;
-
-/** @class Special Special.h
- *
- *  Tool for special samples (Higgs, W, Z, ...) generation.
- *  Concrete implementation of ISampleGenerationTool using
- *  the ExternalGenerator base class.
- *
- *  @author Patrick Robbe
- *  @date   2005-11-14
- */
-class Special : public ExternalGenerator {
- public:
-  /// Standard constructor
-  Special( const std::string& type, const std::string& name,
-           const IInterface* parent);
-
-  virtual ~Special( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize function
-  StatusCode finalize() override;
-
-  /** Generate a single interaction (No Pile-up for the moment.
-   *  Implements ISampleGenerationTool::generate.
-   *  Accepts all events generated with the IProductionTool
-   *  (usually configured with special options) and passing
-   *  the generator level cut.
-   */
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-  /// Implements ISampleGenerationTool::printCounters
-  void printCounters( ) const override;
-
-private:
-  /// XML Log file
-  ICounterLogFile * m_xmlLogTool ;
-
-  /// Counter of events before the generator level cut
-  unsigned int m_nEventsBeforeCut ;
-
-  /// Counter of events after the generator level cut
-  unsigned int m_nEventsAfterCut ;
-
-  /// Number of pile-up events to generate at once
-  unsigned int m_maxInteractions ;
-
-  /// Vector to contain pile-up events
-  std::vector< HepMC::GenEvent * > m_pileUpEventsVector ;
-
-  /// Vector to contain collision infos
-  std::vector< LHCb::GenCollision * > m_pileUpCollisionsVector ;
-
-  /// function to generate a set of pile up events
-  void generatePileUp() ;
-
-  /// production tool which generates pile-up interactions
-  IProductionTool * m_pileUpProductionTool ;
-
-  /// flag to reinitialize the pile up generator
-  bool m_reinitialize ;
-
-  /// Name of the production tool for pile-up
-  std::string m_pileUpProductionToolName ;
-
-  /// Copy collision FROM to TO
-  void copyCollision( const LHCb::GenCollision * FROM ,
-                      LHCb::GenCollision * TO ) const ;
-};
-#endif // GENERATORS_SPECIAL_H
diff --git a/Gen/Generators/src/component/StandAloneDecayTool.cpp b/Gen/Generators/src/component/StandAloneDecayTool.cpp
deleted file mode 100755
index 93f079766bc6c944ba580a264ae7e6794440ff73..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/StandAloneDecayTool.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// $Id: StandAloneDecayTool.cpp,v 1.4 2008-07-24 22:06:07 robbep Exp $
-// Include files 
-#include "StandAloneDecayTool.h"
-
-// from Gaudi
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-
-// from Generators
-#include "MCInterfaces/IDecayTool.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : StandAloneDecayTool
-//
-// 2006-04-18 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the tool factory
-
-DECLARE_COMPONENT( StandAloneDecayTool )
-
-//=============================================================================
-// const constructor, initializes variables
-//=============================================================================
-StandAloneDecayTool::StandAloneDecayTool( const std::string& type ,
-                                          const std::string& name ,
-                                          const IInterface * parent )
-  : Signal ( type , name , parent ) , m_signalMass( 0. ) {
-    declareProperty ( "Inclusive" , m_inclusive = false ) ;
-  } 
-//=============================================================================
-// Destructor
-//=============================================================================
-StandAloneDecayTool::~StandAloneDecayTool() {} 
-
-//=============================================================================
-// Initialization
-//=============================================================================
-StatusCode StandAloneDecayTool::initialize() {
-  StatusCode sc = Signal::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-
-  debug() << "==> Initialize" << endmsg;
-
-  LHCb::IParticlePropertySvc * ppSvc = 
-    svc< LHCb::IParticlePropertySvc >( "LHCb::ParticlePropertySvc" ) ;
-  const LHCb::ParticleProperty * prop = ppSvc -> find( LHCb::ParticleID( *m_pids.begin() ) ) ;
-  m_signalMass = prop -> mass() ;
-
-  release( ppSvc ) ;
-
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-bool StandAloneDecayTool::generate( const unsigned int nPileUp , 
-                                    LHCb::HepMCEvents * theEvents ,
-                                    LHCb::GenCollisions * theCollisions ) {
-  // prepare event
-  LHCb::GenCollision * theGenCollision( 0 ) ;
-  HepMC::GenEvent * theGenEvent( 0 ) ;
-
-  // generate the requested number of "pile-up" events
-  for ( unsigned int i = 0 ; i < nPileUp ; ++i ) {
-    prepareInteraction( theEvents , theCollisions , theGenEvent , 
-                        theGenCollision ) ;
-    
-    // Particle to decay
-    HepMC::GenParticle * theParticle = new HepMC::GenParticle( ) ;
-    theParticle -> 
-      set_momentum( HepMC::FourVector( 0. , 0. , 0., m_signalMass ) ) ;
-
-    // Decay the particle at (0,0,0,0)
-    HepMC::GenVertex * theVertex = 
-      new HepMC::GenVertex( HepMC::FourVector( 0., 0., 0., 0. ) ) ;
-    theGenEvent -> add_vertex( theVertex ) ;
-    theVertex -> add_particle_out( theParticle ) ;
-    
-    bool flip( false ) ;
-    
-    int thePID = *m_pids.begin() ;
-    if ( m_cpMixture ) {
-      // decide the PID to generate
-      double flavour = m_flatGenerator() ;
-      m_decayTool -> enableFlip() ;
-      
-      if ( flavour < 0.5 ) 
-        theParticle -> set_pdg_id( +abs( thePID ) ) ;
-      else
-        theParticle -> set_pdg_id( -abs( thePID ) ) ;
-    } else {
-      m_decayTool -> disableFlip() ;
-      theParticle -> set_pdg_id( thePID ) ;
-    }
-
-    if ( ! m_inclusive ) 
-      m_decayTool -> generateSignalDecay( theParticle , flip ) ;
-    else 
-      m_decayTool -> generateDecay( theParticle ) ;
-    
-    theParticle -> set_status( LHCb::HepMCEvent::SignalInLabFrame ) ;
-  
-    theGenEvent -> 
-      set_signal_process_vertex( theParticle -> end_vertex() ) ;
-    theGenCollision -> setIsSignal( true ) ;
-  }
-  
-  return true ;
-}
-
-//=============================================================================
-
diff --git a/Gen/Generators/src/component/StandAloneDecayTool.h b/Gen/Generators/src/component/StandAloneDecayTool.h
deleted file mode 100755
index 985a374d1684f763c031d72b88bbe3eb69923a75..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/StandAloneDecayTool.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// $Id: StandAloneDecayTool.h,v 1.3 2007-09-09 19:33:10 robbep Exp $
-#ifndef GENERATORS_STANDALONEDECAYTOOL_H
-#define GENERATORS_STANDALONEDECAYTOOL_H 1
-
-// Include files
-// from Gaudi
-#include "Generators/Signal.h"
-
-
-/** @class StandAloneDecayTool StandAloneDecayTool.h component/StandAloneDecayTool.h
- *  Class to generate decay with only the decay tool
- *
- *  @author Patrick Robbe
- *  @date   2006-04-18
- */
-class StandAloneDecayTool : public Signal {
-public:
-  /// Standard constructor
-  StandAloneDecayTool( const std::string & type , const std::string & name ,
-                       const IInterface * parent ) ;
-
-  virtual ~StandAloneDecayTool( ) ; ///< Destructor
-
-  StatusCode initialize( ) override;    ///< Tool initialization
-
-  bool generate( const unsigned int nPileUp ,
-                 LHCb::HepMCEvents * theEvents ,
-                 LHCb::GenCollisions * theCollisions ) override;
-
-private:
-  double m_signalMass ; ///< Mass of the particle to decay
-
-  bool m_inclusive ;  ///< Generate inclusive decay
-};
-#endif // GENERATORS_STANDALONEDECAYTOOL_H
diff --git a/Gen/Generators/src/component/UniformSmearVertex.cpp b/Gen/Generators/src/component/UniformSmearVertex.cpp
deleted file mode 100755
index 8319491926601522c91c1ded573e4487a8aafba1..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/UniformSmearVertex.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// $Id: UniformSmearVertex.cpp,v 1.5 2008-07-24 22:05:38 robbep Exp $
-// Include files 
-
-// local
-#include "UniformSmearVertex.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h" 
-#include "GaudiKernel/PhysicalConstants.h"
-#include "GaudiKernel/Vector4DTypes.h"
-
-// from Event
-#include "Event/HepMCEvent.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : UniformSmearVertex
-//
-// 2007-09-07 : M.Ferro-Luzzi
-// 2007-09-27 : G.Corti, use twopi from PhysicalConstants.h instead of 
-//              hardcoded number
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( UniformSmearVertex )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-UniformSmearVertex::UniformSmearVertex( const std::string& type,
-                                        const std::string& name,
-                                        const IInterface* parent )
-  : GaudiTool ( type, name , parent ) , 
-    m_rmaxsq( 0. ) , 
-    m_deltaz( 0. ) {
-    declareInterface< IVertexSmearingTool >( this ) ;
-    declareProperty( "RMax"   , m_rmax   =     1. * Gaudi::Units::mm ) ;
-    declareProperty( "ZMin"   , m_zmin   = -1500. * Gaudi::Units::mm ) ;
-    declareProperty( "ZMax"   , m_zmax   =  1500. * Gaudi::Units::mm ) ;
-    declareProperty( "BeamDirection", m_zDir = 1 );
-
-}
-
-//=============================================================================
-// Destructor 
-//=============================================================================
-UniformSmearVertex::~UniformSmearVertex( ) { ; }
-
-//=============================================================================
-// Initialize 
-//=============================================================================
-StatusCode UniformSmearVertex::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-  
-  if ( !(m_zmin < m_zmax) ) return Error( "zMin >= zMax !" ) ;
-  if ( !(m_rmax > 0.    ) ) return Error( "rMax <=  0  !" ) ;
-  m_deltaz =  m_zmax - m_zmin       ;
-  m_rmaxsq = m_rmax*m_rmax          ;
-
-  IRndmGenSvc* randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-  sc = m_flatDist.initialize( randSvc , Rndm::Flat( 0.0 , 1.0 ) ) ;
-  if ( ! sc.isSuccess() ) 
-    return Error( "Could not initialize flat random number generator" ) ;
-
-  std::string infoMsg = " applying TOF of interaction with ";
-  if ( m_zDir == -1 ) {
-    infoMsg = infoMsg + "negative beam direction";
-  } else if ( m_zDir == 1 ) {
-    infoMsg = infoMsg + "positive beam direction";
-  } else if ( m_zDir == 0 ) {
-    infoMsg = " with TOF of interaction equal to zero ";
-  } else {
-    return Error("BeamDirection can only be set to -1 or 1, or 0 to switch off TOF");
-  }
-
-  info() << "Smearing of interaction point with flat distribution "
-         << " in x, y and z " << endmsg;
-  info() << infoMsg << endmsg;
-  if( msgLevel(MSG::DEBUG) ) {
-    debug() << " with r less than " << m_rmax / Gaudi::Units::mm 
-            << " mm." << endmsg ;
-    debug() << " with z between " << m_zmin / Gaudi::Units::mm 
-            << " mm and " << m_zmax / Gaudi::Units::mm << " mm." << endmsg ;
-  } else {
-    info() << " with r <= " << m_rmax / Gaudi::Units::mm << " mm, "
-           << m_zmin / Gaudi::Units::mm << " mm <= z <= " 
-           << m_zmax / Gaudi::Units::mm << " mm." << endmsg;
-  }
-
-  release( randSvc ) ;
- 
-  return sc ;
-}
-
-//=============================================================================
-// Smearing function
-//=============================================================================
-StatusCode UniformSmearVertex::smearVertex( LHCb::HepMCEvent * theEvent ) {
-  double dx , dy , dz, dt, rsq, r, th ;
-  
-  // generate flat in z, r^2 and theta:
-  dz  = m_deltaz   * m_flatDist( ) + m_zmin ;
-  rsq = m_rmaxsq   * m_flatDist( )          ;
-  th  = Gaudi::Units::twopi * m_flatDist( ) ;
-  r   = sqrt(rsq) ;
-  dx  = r*cos(th) ;  
-  dy  = r*sin(th) ;
-  dt  = m_zDir * dz/Gaudi::Units::c_light ;
-  Gaudi::LorentzVector dpos( dx , dy , dz , dt ) ;
-  
-  HepMC::GenEvent::vertex_iterator vit ;
-  HepMC::GenEvent * pEvt = theEvent -> pGenEvt() ;
-  for ( vit = pEvt -> vertices_begin() ; vit != pEvt -> vertices_end() ; 
-        ++vit ) {
-    Gaudi::LorentzVector pos ( (*vit) -> position() ) ;
-    pos += dpos ;
-    (*vit) -> set_position( HepMC::FourVector( pos.x() , pos.y() , pos.z() ,
-                                               pos.t() ) ) ;
-  }
-
-  return StatusCode::SUCCESS ;      
-}
-
diff --git a/Gen/Generators/src/component/UniformSmearVertex.h b/Gen/Generators/src/component/UniformSmearVertex.h
deleted file mode 100755
index 34d3d37fa441f01467f0529863843c9f5364d10e..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/UniformSmearVertex.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// $Id: UniformSmearVertex.h,v 1.2 2008-05-06 08:21:00 gcorti Exp $
-#ifndef GENERATORS_UNIFORMSMEARVERTEX_H
-#define GENERATORS_UNIFORMSMEARVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IVertexSmearingTool.h"
-
-/** @class UniformSmearVertex UniformSmearVertex.h "UniformSmearVertex.h"
- *
- *  Tool to smear vertex with flat distribution along the z-axis and
- *  in the xy plane (within a radius). Simple modification of Patrick
- *  Robbe's FlatZSmearVertex.
- *  Concrete implementation of a IVertexSmearingTool.
- *
- *  @author Massi Ferro-Luzzi
- *  @date   2007-09-07
- */
-class UniformSmearVertex : public GaudiTool,
-                           virtual public IVertexSmearingTool {
- public:
-  /// Standard constructor
-  UniformSmearVertex( const std::string& type , const std::string& name,
-                      const IInterface* parent ) ;
-
-  virtual ~UniformSmearVertex( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /** Implements IVertexSmearingTool::smearVertex.
-   *  Does the same than BeamSpotSmearVertex::smearVertex for the x and y
-   *  direction but generates flat distribution for the z-coordinate of
-   *  the primary vertex.
-   */
-  StatusCode smearVertex( LHCb::HepMCEvent * theEvent ) override;
-
- private:
-  /// Maximum value for the r coordinate of the vertex (set by options)
-  double m_rmax   ;
-
-  /// Minimum value for the z coordinate of the vertex (set by options)
-  double m_zmin   ;
-
-  /// Maximum value for the z coordinate of the vertex (set by options)
-  double m_zmax   ;
-
-  /// Square of m_rmax                     (set at initialisation)
-  double m_rmaxsq ;
-
-  /// Difference between m_zmax and m_zmin (set at initialisation)
-  double m_deltaz ;
-
-  /// Direction of the beam to take into account TOF vs nominal IP8, can have
-  /// only values -1 or 1, or 0 to switch off the TOF and set time of
-  /// interaction to zero (default = 1, as for beam 1)
-  int m_zDir;
-
-  Rndm::Numbers m_flatDist ; ///< Flat random number generator
-};
-#endif // GENERATORS_UNIFORMSMEARVERTEX_H
diff --git a/Gen/Generators/src/component/VariableLuminosity.cpp b/Gen/Generators/src/component/VariableLuminosity.cpp
deleted file mode 100755
index c58ef8056f25fb5259f5ca912797335d07ef1108..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/VariableLuminosity.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// $Id: VariableLuminosity.cpp,v 1.6 2009-04-07 16:11:21 gcorti Exp $
-// Include files
-
-// local
-#include "VariableLuminosity.h"
-
-// from Gaudi
-#include "GaudiKernel/IRndmGenSvc.h"
-
-// From CLHEP
-#include "CLHEP/Units/SystemOfUnits.h"
-
-// From Event
-#include "Event/BeamParameters.h"
-#include "Event/GenFSR.h"
-#include "Event/GenCountersFSR.h"
-
-// From Generators
-#include "Generators/GenCounters.h"
-#include "Generators/ICounterLogFile.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : VariableLuminosity
-//
-// 2005-08-17 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-
-DECLARE_COMPONENT( VariableLuminosity )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-VariableLuminosity::VariableLuminosity( const std::string& type,
-                                        const std::string& name,
-                                        const IInterface* parent )
-  : GaudiTool ( type, name , parent ) ,
-    m_xmlLogTool( 0 ) ,
-    m_numberOfZeroInteraction( 0 ) ,
-    m_nEvents( 0 ),
-    m_randSvc( 0 ) {
-
-    using CLHEP::s;
-    declareInterface< IPileUpTool >( this ) ;
-    declareProperty ( "GenFSRLocation", m_FSRName =
-                      LHCb::GenFSRLocation::Default);
-    declareProperty( "BeamParameters" ,
-                     m_beamParameters = LHCb::BeamParametersLocation::Default ) ;
-    declareProperty ( "FillDuration"  , m_fillDuration  = 7.0 * 3600 * s    ) ;
-    declareProperty ( "BeamDecayTime" , m_beamDecayTime = 10.0 * 3600 * s   ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-VariableLuminosity::~VariableLuminosity( ) { ; }
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode VariableLuminosity::initialize( ) {
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Initialize the number generator
-  m_randSvc = svc< IRndmGenSvc >( "RndmGenSvc" , true ) ;
-
-  // XML file
-  m_xmlLogTool = tool< ICounterLogFile >( "XmlCounterLogFile" ) ;
-
-  sc = m_flatGenerator.initialize( m_randSvc , Rndm::Flat( 0 , 1 ) ) ;
-  if ( ! sc.isSuccess() )
-    return Error( "Could not initialize flat random generator" ) ;
-
-  using CLHEP::s;
-  info() << "Poisson distribution with 'LHCb mean'. " << endmsg ;
-  info() << "Fill duration (hours): " << m_fillDuration / 3600 / s << endmsg ;
-  info() << "Beam decay time (hours): " << m_beamDecayTime / 3600 / s
-         << endmsg ;
-
-  return sc ;
-}
-
-//=============================================================================
-// Compute the number of pile up to generate according to beam parameters
-//=============================================================================
-unsigned int VariableLuminosity::numberOfPileUp( ) {
-  LHCb::BeamParameters * beam = get< LHCb::BeamParameters >( m_beamParameters ) ;
-  if ( 0 == beam ) Exception( "No beam parameters registered" ) ;
-
-  LHCb::GenFSR* genFSR = nullptr;
-  if(m_FSRName != ""){
-    IDataProviderSvc* fileRecordSvc = svc<IDataProviderSvc>("FileRecordDataSvc", true);
-    genFSR = getIfExists<LHCb::GenFSR>(fileRecordSvc, m_FSRName, false);
-    if(!genFSR) warning() << "Could not find GenFSR at " << m_FSRName << endmsg;
-  }
-  int key = 0;
-
-  unsigned int result = 0 ;
-  double mean , currentLuminosity;
-  while ( 0 == result ) {
-    m_nEvents++ ;
-    key = LHCb::GenCountersFSR::AllEvt;
-    if(genFSR) genFSR->incrementGenCounter(key,1);
-    currentLuminosity = beam -> luminosity() * m_fillDuration / m_beamDecayTime /
-      ( 1.0 - exp( -m_fillDuration / m_beamDecayTime ) ) ;
-
-    mean = currentLuminosity * beam -> totalXSec() / beam -> revolutionFrequency() ;
-    Rndm::Numbers poissonGenerator( m_randSvc , Rndm::Poisson( mean ) ) ;
-    result = (unsigned int) poissonGenerator() ;
-    if ( 0 == result ) {
-      m_numberOfZeroInteraction++ ;
-      key =LHCb::GenCountersFSR::ZeroInt;
-      if(genFSR) genFSR->incrementGenCounter(key, 1);
-    }
-  }
-
-  return result ;
-}
-
-//=============================================================================
-// Print the specific pile up counters
-//=============================================================================
-void VariableLuminosity::printPileUpCounters( ) {
-  using namespace GenCounters ;
-  printCounter( m_xmlLogTool , "all events (including empty events)" , m_nEvents ) ;
-  printCounter( m_xmlLogTool , "events with 0 interaction" ,
-                m_numberOfZeroInteraction ) ;
-}
-
-//=============================================================================
-// Finalize method
-//=============================================================================
-StatusCode VariableLuminosity::finalize( ) {
-  release( m_randSvc ) ;
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/VariableLuminosity.h b/Gen/Generators/src/component/VariableLuminosity.h
deleted file mode 100755
index 55ec9f29e0a8c7879ee893a114153f83c5423904..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/VariableLuminosity.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// $Id: VariableLuminosity.h,v 1.3 2009-04-07 16:11:21 gcorti Exp $
-#ifndef GENERATORS_VARIABLELUMINOSITY_H
-#define GENERATORS_VARIABLELUMINOSITY_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiKernel/RndmGenerators.h"
-
-#include "Generators/IPileUpTool.h"
-
-// Forward declarations
-class IRndmGenSvc ;
-class ICounterLogFile ;
-
-/** @class VariableLuminosity VariableLuminosity.h "VariableLuminosity.h"
- *
- *  Tool to compute variable number of pile up events depending on beam
- *  parameters, with time-dependant luminosity. Concrete implementation
- *  of a IPileUpTool.
- *
- *  @author Patrick Robbe
- *  @date   2005-08-17
- */
-class VariableLuminosity : public GaudiTool, virtual public IPileUpTool {
-public:
-  /// Standard constructor
-  VariableLuminosity( const std::string& type, const std::string& name,
-                      const IInterface* parent);
-
-  virtual ~VariableLuminosity( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize method
-  StatusCode finalize( ) override;
-
-  /** Compute number of interactions and returns luminosity
-   *  Implements IPileUpTool::numberOfPileUp.
-   *  The number of pileup interactions follows a Poisson law
-   *  with mean equal to Luminosity * cross_section / crossing_frequency
-   *  The Luminosity is exponentially decreasing with beam decay time.
-   *  The mean luminosity is given in options so the maximum luminosity
-   *  (at t=0) is computed using the fill duration.
-   */
-  unsigned int numberOfPileUp( ) override;
-
-  /// Implements IPileUpTool::printPileUpCounters
-  void printPileUpCounters( ) override;
-
-private:
-  /// Location where to store FSR counters (set by options)
-  std::string  m_FSRName;
-
-  std::string m_beamParameters ; ///< Location of beam parameters (set by options)
-
-  double m_fillDuration ; ///< Fill duration (set by options)
-
-  double m_beamDecayTime ; ///< Beam decay time (set by options)
-
-  /// XML Log tool
-  ICounterLogFile * m_xmlLogTool ;
-
-  /// Counter of empty interactions
-  int    m_numberOfZeroInteraction ;
-
-  /// Counter of events (including empty interactions)
-  int    m_nEvents ;
-
-  /// Random number generator service
-  IRndmGenSvc * m_randSvc ;
-
-  /// Flat random number generator
-  Rndm::Numbers m_flatGenerator ;
-};
-#endif // GENERATORS_VARIABLELUMINOSITY_H
diff --git a/Gen/Generators/src/component/WriteHepMCAsciiFile.cpp b/Gen/Generators/src/component/WriteHepMCAsciiFile.cpp
deleted file mode 100755
index e5cb53c57dd5d5f9e8bfd5f85d8771a3a1fb6a42..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/WriteHepMCAsciiFile.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// $Id: WriteHepMCAsciiFile.cpp,v 1.3 2008-07-09 14:39:08 robbep Exp $
-//
-// ============================================================================
-// Include files
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/SystemOfUnits.h"
-#include "GaudiKernel/PhysicalConstants.h"
-// ============================================================================
-// GaudiAlg
-// ============================================================================
-#include "GaudiAlg/GaudiAlgorithm.h"
-// ============================================================================
-// Event
-// ============================================================================
-#include "Event/HepMCEvent.h"
-// ============================================================================
-// HepMC
-// ============================================================================
-#include "HepMC/IO_GenEvent.h"
-// ============================================================================
-/** @class WriteHepMCAsciiFile WriteHepMCAsciiFile.cpp
- *
- *  Simple class to dump generators events in plain
- *  output file in HepMC Ascii format. It could be used for portable
- *  cross-transitions of events inbetween different generators
- *
- *   The algorithm has 3 properties:
- *
- *    - <c>Input</c>  : The TES location of LHCb::HepMCEvent::Container
- *              ( the default value is <c>LHCb::HepMCEventLocation::Default</c>)
- *    - <c>Ouput</c>  : The name of output HepMC Ascii file.
- *                     The file is opened in "new/overwrite" mode.
- *                     ( the default value is <c>""</c> (empty string)
- *
- *  @author Vanya BELYAEV ibelyaev@physics.syr.edu
- *  @date 2005-10-05
- */
-class WriteHepMCAsciiFile : public GaudiAlgorithm
-{
-public:
-  /// initialize the algorithm
-  StatusCode initialize () override
-  {
-    StatusCode sc = GaudiAlgorithm::initialize() ;
-    if ( sc.isFailure() ) { return sc ; }
-    /// check the output file
-    if ( m_output.empty() )
-    { return Error ( "Output file name is not specified!" ) ; }
-    // open the file
-    m_file = new HepMC::IO_GenEvent
-      ( m_output.c_str() , std::ios::out | std::ios::trunc ) ;
-    //
-    if ( 0 == m_file || m_file->rdstate() == std::ios::failbit )
-    { return Error ( "Failure to open the file '"+m_output+"'" ) ; }
-    if(m_momentum_unit_name == "GeV"){
-      m_momentum_unit = HepMC::Units::GEV;
-    } else if (m_momentum_unit_name == "MeV") {
-      m_momentum_unit = HepMC::Units::MEV;
-    } else {
-      return Error("Invalid momentum unit");
-    }
-
-    if(m_length_unit_name == "CM"){
-      m_length_unit = HepMC::Units::CM;
-    } else if (m_length_unit_name == "MM") {
-      m_length_unit = HepMC::Units::MM;
-    } else {
-      return Error("Invalid length unit");
-    }
-    //
-    //m_file->write_comment( "Written by WriteHepMCAsciiFile/"+name() );
-    //
-    return StatusCode::SUCCESS ;
-  } ;
-  /// execute it!
-  StatusCode execute    () override;
-  /// finalize the algorithm
-  StatusCode finalize   () override
-  {
-    // delete the stream  (close the file!)
-    if ( 0 != m_file ) { delete m_file ; m_file = 0 ; }
-    // finalize the base class ;
-    return GaudiAlgorithm::finalize() ;
-  }
-  /** standard constructor
-   *  @param name algorithm instance name
-   *  @param pSvc ppinter to Service Locator
-   */
-  WriteHepMCAsciiFile
-  ( const std::string& name ,
-    ISvcLocator*       pSvc )
-    : GaudiAlgorithm ( name , pSvc )
-    // default location of HepMC events in TES
-    , m_input    ( LHCb::HepMCEventLocation::Default )
-    // no default value!
-    , m_output   (   )
-    // the file itself
-    , m_file     ( 0 )
-  {
-    declareProperty  ( "Input"   , m_input   ) ;
-    declareProperty  ( "Output"  , m_output  ) ;
-    declareProperty  ( "MomentumUnit" , m_momentum_unit_name = "", "Momentum unit [GeV, MeV]") ;
-    declareProperty  ( "LengthUnit" , m_length_unit_name = "MM", "Length unit [MM, CM]") ;
-  } ;
-  virtual ~WriteHepMCAsciiFile()
-  { if ( 0 != m_file ) { delete m_file ; m_file = 0  ; } }
-private:
-  // TES location of HepMC-events
-  std::string      m_input  ; ///< TES location of HepMC-events
-  // the name of the output file
-  std::string      m_output ; ///< the name of the output file
-  // rescale event from LHCb to Pythia units ?
-  std::string m_momentum_unit_name{};
-  std::string m_length_unit_name{}; ///< rescale event from LHCb units ?
-  HepMC::Units::MomentumUnit m_momentum_unit;
-  HepMC::Units::LengthUnit m_length_unit;
-  // the output file ;
-  HepMC::IO_GenEvent* m_file   ; ///< the output file ;
-} ;
-// ===========================================================================
-/// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( WriteHepMCAsciiFile )
-// ===========================================================================
-/// Execut the algorithm
-StatusCode WriteHepMCAsciiFile::execute    ()
-{
-  /// get input events
-  LHCb::HepMCEvent::Container* events
-    = get<LHCb::HepMCEvent::Container>( m_input ) ;
-  if ( 0 == events ) { return StatusCode::FAILURE ; }
-  //
-  Assert ( 0 != m_file , "File is invalid!" ) ;
-  //
-  // loop over events and write them
-  for ( LHCb::HepMCEvent::Container::iterator
-          ievent = events->begin() ; events->end() != ievent  ; ++ievent )
-  {
-    LHCb::HepMCEvent* event = *ievent ;
-    if ( 0 == event ) { continue ; }
-    HepMC::GenEvent* evt = event->pGenEvt();
-    if ( 0 == evt   ) { continue ; }
-    auto old_mom_unit = evt->momentum_unit();
-    auto old_length_unit = evt->length_unit();
-
-    // rescale the event if needed
-    evt->use_units(m_momentum_unit, m_length_unit);
-
-    // write event to ascii file
-    m_file->write_event(evt); 	//also writes HeavyIon and PdfInfo!
-
-    // rescale back if needed (convert to LHCb units)
-    evt->use_units(old_mom_unit, old_length_unit);
-  }
-  //
-  return StatusCode::SUCCESS ;
-}
-// ===========================================================================
-
-// ===========================================================================
-// The END
-// ===========================================================================
diff --git a/Gen/Generators/src/component/XmlCounterLogFile.cpp b/Gen/Generators/src/component/XmlCounterLogFile.cpp
deleted file mode 100644
index 35fb3c2fd9db034db4f7a86dde7ecceff88668c2..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/XmlCounterLogFile.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// Include files
-// local
-#include "XmlCounterLogFile.h"
-
-// from BOOST
-#include "boost/filesystem/path.hpp"
-#include "boost/filesystem.hpp"
-
-// from Gaudi
-
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : XmlCounterLogFile
-//
-// 2013-01-15 : Patrick Robbe
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( XmlCounterLogFile )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-XmlCounterLogFile::XmlCounterLogFile( const std::string& type,
-                                      const std::string& name,
-                                      const IInterface* parent )
-: GaudiTool ( type, name , parent ) , m_version( "1.1" ) 
-{
-  declareInterface<ICounterLogFile>(this);
-  declareProperty( "FileName" , m_fileName = "GeneratorLog.xml" ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-XmlCounterLogFile::~XmlCounterLogFile() {} 
-
-//=============================================================================
-// Add efficiency in xml file
-//=============================================================================
-void XmlCounterLogFile::addEfficiency( const std::string & name , const unsigned int after , 
-                                       const unsigned int before , const double fraction , 
-                                       const double err_fraction )
-{
-  m_file << "  <efficiency name = \"" << name << "\">" << std::endl 
-         << "    <after> " << after << " </after>" << std::endl
-         << "    <before> " << before << " </before>" << std::endl 
-         << "    <value> " << format( "%.5g" , fraction ) << " </value>" << std::endl 
-         << "    <error> " << format( "%.5g" ,err_fraction ) << " </error>" << std::endl 
-         << "  </efficiency>" << std::endl ;
-}
-
-//=============================================================================
-// Add counter in xml file
-//=============================================================================
-void XmlCounterLogFile::addCounter( const std::string & name , const unsigned int value ) 
-{
-  m_file << "  <counter name = \"" << name << "\">" << std::endl
-         << "    <value> " << value << " </value>" << std::endl 
-         << "  </counter>" << std::endl ;
-}
-
-//=============================================================================
-// Add fraction in xml file
-//=============================================================================
-void XmlCounterLogFile::addFraction( const std::string & name , const unsigned int number , 
-                                     const double fraction , const double err_fraction ) 
-{
-  m_file << "  <fraction name = \"" << name << "\">" << std::endl 
-         << "    <number> " << number << " </number>" << std::endl
-         << "    <value> " << format( "%.5g" , fraction ) << " </value>" << std::endl 
-         << "    <error> " << format( "%.5g" , err_fraction ) << " </error>" << std::endl 
-         << "  </fraction>" << std::endl ;
-}
-
-//=============================================================================
-// Add cross section value
-//=============================================================================
-void XmlCounterLogFile::addCrossSection( const std::string & name , 
-                                         const unsigned int processId , 
-                                         const unsigned int number , 
-                                         const double value ) 
-{
-  m_file << "  <crosssection id = \"" << processId << "\">" << std::endl 
-         << "    <description> \""<< name << "\" </description>" << std::endl
-         << "    <generated> " << number << " </generated>" << std::endl 
-         << "    <value> " << format( "%.5g" , value ) << " </value>" << std::endl 
-         << "  </crosssection>" << std::endl ;
-}
-
-//=============================================================================
-// Add event type value
-//=============================================================================
-void XmlCounterLogFile::addEventType( const unsigned int evType )
-{
-  m_file << "  <eventType>" << evType << "</eventType>" << std::endl ;
-}
-
-//=============================================================================
-// Add version value
-//=============================================================================
-void XmlCounterLogFile::addGaussVersion( const std::string & version )
-{
-  m_file << "  <gaussVersion>" << version << "</gaussVersion>" << std::endl ;
-}
-
-//=============================================================================
-// Add version value
-//=============================================================================
-void XmlCounterLogFile::addMethod( const std::string & type )
-{
-  m_file << "  <method>" << type << "</method>" << std::endl ;
-}
-
-//=============================================================================
-// Add version value
-//=============================================================================
-void XmlCounterLogFile::addGenerator( const std::string & generator )
-{
-  m_file << "  <generator>" << generator << "</generator>" << std::endl ;
-}
-
-//=============================================================================
-// Initialize function
-//=============================================================================
-StatusCode XmlCounterLogFile::initialize( ) 
-{
-  StatusCode sc = GaudiTool::initialize( ) ;
-  if ( sc.isFailure() ) return sc ;
-
-  // Opens the file
-  if ( boost::filesystem::exists( m_fileName ) ) boost::filesystem::remove( m_fileName ) ;
-  
-  m_file.open( m_fileName.c_str() ) ;
-  if (  ! m_file.is_open() ) 
-    return Error( "Cannot open xml log file" ) ;
-  
-  m_file << "<?xml version=\"1.0\"?>" << std::endl 
-         << "<generatorCounters>" << std::endl 
-         << "  <version>" << m_version << "</version>" << std::endl ;
-
-  return StatusCode::SUCCESS ;
-}
-
-//=============================================================================
-// Finalize function
-//=============================================================================
-StatusCode XmlCounterLogFile::finalize( ) 
-{
-  m_file << "</generatorCounters>" << std::endl ;
-  m_file.close() ;
-  return GaudiTool::finalize( ) ;
-}
diff --git a/Gen/Generators/src/component/XmlCounterLogFile.h b/Gen/Generators/src/component/XmlCounterLogFile.h
deleted file mode 100644
index 0f515923af301f3e3559a0fcf140e19fbe7c3622..0000000000000000000000000000000000000000
--- a/Gen/Generators/src/component/XmlCounterLogFile.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef GENERATORS_XMLCOUNTERLOGFILE_H
-#define GENERATORS_XMLCOUNTERLOGFILE_H 1
-
-// Include files
-// from STL
-#include <string>
-#include <fstream>
-
-// from Gaudi
-#include "GaudiAlg/GaudiTool.h"
-#include "Generators/ICounterLogFile.h"            // Interface
-
-/** @class XmlCounterLogFile XmlCounterLogFile.h component/XmlCounterLogFile.h
- *
- *  Tool to write counters in a xml file
- *
- *  @author Patrick Robbe
- *  @date   2013-01-15
- */
-class XmlCounterLogFile : public GaudiTool, virtual public ICounterLogFile {
-public:
-  /// Standard constructor
-  XmlCounterLogFile( const std::string& type,
-                     const std::string& name,
-                     const IInterface* parent);
-
-  virtual ~XmlCounterLogFile( ); ///< Destructor
-
-  /// Initialize method
-  StatusCode initialize( ) override;
-
-  /// Finalize method
-  StatusCode finalize( ) override;
-
-  /// Add efficiency number
-  void addEfficiency( const std::string & name , const unsigned int after ,
-                      const unsigned int before , const double fraction ,
-                      const double err_fraction ) override;
-
-  void addCounter( const std::string & name , const unsigned int value ) override;
-
-  void addFraction( const std::string & name , const unsigned int number ,
-                    const double fraction , const double err_fraction ) override;
-
-  void addCrossSection( const std::string & name ,
-                        const unsigned int processId ,
-                        const unsigned int number ,
-                        const double value ) override;
-
-  void addEventType( const unsigned int evType ) override;
-
-  /// Add the Gauss version
-  void addGaussVersion( const std::string & version ) override;
-
-  void addMethod( const std::string & type ) override;
-
-  void addGenerator( const std::string & generator ) override;
-
-protected:
-
-private:
-  std::string     m_version ;
-  std::string     m_fileName ;
-  std::ofstream   m_file ;
-
-};
-#endif // GENERATORS_XMLCOUNTERLOGFILE_H
diff --git a/Gen/LPair/.gaudi_project_ignore b/Gen/LPair/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbAmpGen/.gaudi_project_ignore b/Gen/LbAmpGen/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbBcVegPy/.gaudi_project_ignore b/Gen/LbBcVegPy/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbBound/.gaudi_project_ignore b/Gen/LbBound/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbCRMC/.gaudi_project_ignore b/Gen/LbCRMC/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbEvtGen/CMakeLists.txt b/Gen/LbEvtGen/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4f2581c277e71abb1b4ae1f69b43bef09022f84a
--- /dev/null
+++ b/Gen/LbEvtGen/CMakeLists.txt
@@ -0,0 +1,25 @@
+################################################################################
+# Package: LbEvtGen
+################################################################################
+gaudi_subdir(LbEvtGen v1r0)
+
+gaudi_depends_on_subdirs(Gen/EvtGenExtras
+                         HepMCUser
+                         Utils)
+                         
+
+find_package(Boost COMPONENTS filesystem system)
+find_package(ROOT)
+find_package(Photos++)
+AddHepMC3()
+include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${PHOTOS++_INCLUDE_DIRS})
+
+string(REPLACE "-pedantic" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
+string(REPLACE "-Wall" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
+string(REPLACE "-Wextra" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
+string(REPLACE "-Werror=return-type" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
+
+gaudi_add_module(LbEvtGen
+                 src/*.cpp
+                 INCLUDE_DIRS Boost Kernel/MCInterfaces
+                 LINK_LIBRARIES Boost GenEvent GaudiAlgLib LHCbKernel EvtGen EvtGenExtras GeneratorsLib HepMCUtils)
diff --git a/Gen/Generators/src/component/EvtGenDecay.cpp b/Gen/LbEvtGen/src/EvtGenDecay.cpp
similarity index 82%
rename from Gen/Generators/src/component/EvtGenDecay.cpp
rename to Gen/LbEvtGen/src/EvtGenDecay.cpp
index f3e91530fcf071cd783f01e8965b45a6a1bade45..899a72f22fc8d04724aac9b60cda5ac4610bcb85 100755
--- a/Gen/Generators/src/component/EvtGenDecay.cpp
+++ b/Gen/LbEvtGen/src/EvtGenDecay.cpp
@@ -22,13 +22,6 @@
 #include "Kernel/ParticleID.h"
 #include "GaudiKernel/SystemOfUnits.h"
 #include "GaudiKernel/PhysicalConstants.h"
-// from Event
-#include "Event/HepMCEvent.h"
-
-// from HepMC
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenEvent.h"
  
 // from EvtGen
 #include "EvtGen/EvtGen.hh"
@@ -43,13 +36,13 @@
 #include "EvtGenModels/EvtModelRegExtras.hh"
 
 #include "Generators/StreamForGenerator.h"
-#include "Generators/IProductionTool.h"
+#include "GenInterfaces/IProductionTool.h"
 #include "Generators/F77Utils.h" 
 #include "Generators/LbTaula.h"
 #include "Generators/LbPhotos.h"
 
-//EvtGen holding tool
-#include "IEvtGenTool.h"
+#include "HepMCUser/Status.h"
+#include "HepMCUtils/PrintDecayTree.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : EvtGenDecay
@@ -60,55 +53,6 @@
 
 DECLARE_COMPONENT( EvtGenDecay )
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-EvtGenDecay::EvtGenDecay( const std::string& type,
-                          const std::string& name,
-                          const IInterface* parent )
-  : GaudiTool ( type, name , parent ),
-    m_gen(0),
-    m_randomEngine(0),
-    // Minimum value for ctau in particle property data.
-    // Below, it is set to 0
-    m_minctau( 1.e-4 * Gaudi::Units::mm ) ,
-    // Maximum value for ctau in particle property data.
-    // Above, it is set to 0
-    m_maxctau( 1.e+16 * Gaudi::Units::mm ) ,
-    // Minimum value for Gamma in particle property data.
-    // Below, it is set to 0
-    m_minwidth( 1.5e-6 * Gaudi::Units::GeV ) ,
-    // Unit for Taula output
-    m_taulaUnit( 6 ) ,
-    // Unit for PHOTOS output
-    m_photosUnit( 6 ) {
-    // Declare IEvtGenDecay interface
-    declareInterface<IDecayTool>( this ) ;
-    // Declare properties for EvtGen
-    // The generic decay file
-    declareProperty("DecayFile" , m_decayFile = "empty" ) ;
-    // The signal decay file
-    declareProperty("UserDecayFile" , m_userDecay = "empty" ) ;
-    // Keep temporary evt.pdl file
-    declareProperty("KeepTempEvtFile" , m_keepTempEvtFile = false ) ;
-    // Generate Polarized Lambda_b decays
-    declareProperty("PolarizedLambdad" , m_generatePolLambdab = false ) ;
-    declareProperty("TransverseLambdabPol", m_lambdabPol = 1.0 );
-    // Generate Polarized charmonium
-    declareProperty("PolarizedCharmonium" , m_generatePolCharmonium = false ) ;
-    // Parameters for charmonium polarization
-    declareProperty("RealHelOne"  , m_realHelOne  = 1. ) ;
-    declareProperty("ImHelOne"    , m_imHelOne    = 0. ) ;
-    declareProperty("RealHelZero" , m_realHelZero = 1. ) ;
-    declareProperty("ImHelZero"   , m_imHelZero   = 0. ) ;   
-    // Initialize signalId
-    m_signalId = EvtId( -1, -1 ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-EvtGenDecay::~EvtGenDecay( ) { }
 
 //=============================================================================
 // Initialize method
@@ -120,10 +64,6 @@ StatusCode EvtGenDecay::initialize( ) {
   MsgStream * msg = new MsgStream( msgSvc() , name() ) ;
   StreamForGenerator::getStream() = msg ;
 
-  //EvtGenTool
-  debug() << "Getting EvtGenTool" << endmsg ;
-  m_evtgentool = tool<IEvtGenTool>("EvtGenTool") ;
-
   // Find Generic DECAY.DEC file
   // Default location (if not specified in job options is  $DECFILESROOT/dkfiles/DECAY.DEC
   if ( m_decayFile.empty() || "empty" == m_decayFile )
@@ -131,7 +71,7 @@ StatusCode EvtGenDecay::initialize( ) {
       m_decayFile  = System::getEnv( "DECFILESROOT" ) + "/dkfiles/DECAY.DEC" ;
   
   // Check if file exists:
-  if ( ! boost::filesystem::exists( m_decayFile ) ) 
+  if ( ! boost::filesystem::exists( m_decayFile.value() ) ) 
     return Error( "The specified generic decay table does not exist" ) ;
 
   // create temporary evt.pdl file filled with Gaudi ParticlePropertySvc
@@ -148,7 +88,7 @@ StatusCode EvtGenDecay::initialize( ) {
     Exception( "RndmGenSvc not found to initialize EvtGen random engine" ) ;
   }
 
-  m_randomEngine = new EvtGenGaudiRandomEngine( randSvc , sc ) ;
+  m_randomEngine = std::make_unique<RandomEngineWrapper>( );
   if ( ! sc.isSuccess() )
     return Error( "Cannot initialize EvtGenGaudiRandomService" , sc ) ;
   release( randSvc ) ;
@@ -183,11 +123,9 @@ StatusCode EvtGenDecay::initialize( ) {
   }
   
   // create EvtGen engine from decay file, evt.pdl file and random engine
-  if ( m_evtgentool -> isInit() )  m_gen = m_evtgentool->getEvtGen() ;
-  else { 
-    m_gen = new EvtGen ( m_decayFile.c_str() , evtPdlFile.string().c_str() ,
-                         m_randomEngine, isrEngine, models.get()) ;
-    m_evtgentool->setEvtGen( m_gen ) ;
+  if ( !m_gen ){
+    m_gen = std::make_unique<EvtGen>( m_decayFile.value().c_str() , evtPdlFile.string().c_str() ,
+                         m_randomEngine.get(), isrEngine, models.get()) ;
   }
   
   // Remove temporary file if not asked to keep it
@@ -195,9 +133,9 @@ StatusCode EvtGenDecay::initialize( ) {
 
   // Read the optional signal decay file
   if ( ! m_userDecay.empty() && "empty" != m_userDecay ) {
-    if ( ! boost::filesystem::exists( m_userDecay ) ) 
+    if ( ! boost::filesystem::exists( m_userDecay.value() ) ) 
       return Error( "The specified user decay file does not exist" ) ;
-    m_gen -> readUDecay( m_userDecay.c_str() ) ; 
+    m_gen -> readUDecay( m_userDecay.value().c_str() ) ; 
   }
 
   debug() << "EvtGenDecay initialized" << endmsg ;
@@ -209,11 +147,8 @@ StatusCode EvtGenDecay::initialize( ) {
 // Finalize method
 //=============================================================================
 StatusCode EvtGenDecay::finalize() {
-  delete m_randomEngine ;
   
   debug() << "EvtGenDecay finalized" << endmsg ;
- 
-  release( m_evtgentool ) ;
 	
   if ( ! ( msgLevel( MSG::DEBUG ) ) ) { 
     F77Utils::close( m_taulaUnit ) ;
@@ -229,7 +164,8 @@ StatusCode EvtGenDecay::finalize() {
 //=============================================================================
 // Generate a Decay tree from a particle theMother in the event theEvent
 //=============================================================================
-StatusCode EvtGenDecay::generateDecay( HepMC::GenParticle * theMother ) const {
+StatusCode EvtGenDecay::generateDecay( const HepMC3::GenParticlePtr & theMother ,
+                                       HepRandomEnginePtr & ) const {
   // Call EvtGen for the particle to generate
   checkParticle( theMother ) ;
 
@@ -248,7 +184,7 @@ StatusCode EvtGenDecay::generateDecay( HepMC::GenParticle * theMother ) const {
   // correct vertex for daughter particles of theMother
   // because EvtGen gives position with respect to the "root" particle
   // This reference position is production vertex of theMother
-  HepMC::GenVertex * V = theMother -> production_vertex() ;
+  auto V = theMother -> production_vertex() ;
   Gaudi::LorentzVector theOriginPosition( V -> position() ) ;
 
   // Fill HepMC event theEvent with EvtGen decay tree part
@@ -260,7 +196,7 @@ StatusCode EvtGenDecay::generateDecay( HepMC::GenParticle * theMother ) const {
 
   // Set status to "decayed by evtgen"
   theMother -> 
-    set_status( LHCb::HepMCEvent::DecayedByDecayGenAndProducedByProdGen ) ;
+    set_status( HepMC3::Status::DecayedByDecayGenAndProducedByProdGen ) ;
 
   return StatusCode::SUCCESS ;
 }
@@ -268,12 +204,12 @@ StatusCode EvtGenDecay::generateDecay( HepMC::GenParticle * theMother ) const {
 //=============================================================================
 // Generate a Decay tree from a particle theMother in the event theEvent
 //=============================================================================
-StatusCode EvtGenDecay::generateSignalDecay( HepMC::GenParticle * theMother ,
-                                             bool & flip) const {
+StatusCode EvtGenDecay::generateSignalDecay( const HepMC3::GenParticlePtr & theMother ,
+                                             bool & flip ,
+                                             HepRandomEnginePtr & ) const {
   // If particle already has daughters, return now
-  if ( 0 != theMother -> end_vertex() ) {
+  if ( theMother -> end_vertex() ) {
     flip = false ;
-    return StatusCode::SUCCESS ;
   }
   
   // Call EvtGen for the particle to generate
@@ -298,7 +234,7 @@ StatusCode EvtGenDecay::generateSignalDecay( HepMC::GenParticle * theMother ,
   // correct vertex for daughter particles of theMother
   // because EvtGen gives position with respect to the "root" particle
   // This reference position is production vertex of theMother
-  HepMC::GenVertex * PV = theMother -> production_vertex() ;
+  auto PV = theMother -> production_vertex() ;
   Gaudi::LorentzVector theOriginPosition( PV -> position() ) ;
   
   // Fill HepMC event theEvent with EvtGen decay tree part
@@ -309,7 +245,7 @@ StatusCode EvtGenDecay::generateSignalDecay( HepMC::GenParticle * theMother ,
   part -> deleteTree ( ) ;
 
   // Set status to "signal in lab frame"
-  theMother -> set_status( LHCb::HepMCEvent::SignalInLabFrame ) ;
+  theMother -> set_status( HepMC3::Status::SignalInLabFrame ) ;
 
   return StatusCode::SUCCESS ;
 }
@@ -319,8 +255,9 @@ StatusCode EvtGenDecay::generateSignalDecay( HepMC::GenParticle * theMother ,
 // It stops when the particle to decay has a mass larger than theMassLimit
 // or is of the type targetId
 //=============================================================================
-StatusCode EvtGenDecay::generateDecayWithLimit( HepMC::GenParticle * theMother ,
-                                                const int targetId ) const {
+StatusCode EvtGenDecay::generateDecayWithLimit( const HepMC3::GenParticlePtr & theMother ,
+                                                const int targetId ,
+                                                HepRandomEnginePtr & ) const {
   checkParticle( theMother ) ;
 
   EvtParticle * part( 0 ) ;
@@ -338,7 +275,7 @@ StatusCode EvtGenDecay::generateDecayWithLimit( HepMC::GenParticle * theMother ,
   // correct vertex for daughter particles of theMother
   // because EvtGen gives position with respect to the "root" particle
   // This reference position is production vertex of theMother  
-  HepMC::GenVertex * PV = theMother -> production_vertex() ;
+  auto PV = theMother -> production_vertex() ;
   Gaudi::LorentzVector theOriginPosition( PV -> position() ) ;
   
   // Fill HepMC event theEvent with EvtGen decay tree part
@@ -351,7 +288,7 @@ StatusCode EvtGenDecay::generateDecayWithLimit( HepMC::GenParticle * theMother ,
 
   // Set particle status to "decayed by evtgen"
   theMother ->
-    set_status( LHCb::HepMCEvent::DecayedByDecayGenAndProducedByProdGen ) ;
+    set_status( HepMC3::Status::DecayedByDecayGenAndProducedByProdGen ) ;
 
   return StatusCode::SUCCESS ;
 }
@@ -365,9 +302,10 @@ StatusCode EvtGenDecay::generateDecayWithLimit( HepMC::GenParticle * theMother ,
 // will be converted)
 //=============================================================================
 StatusCode EvtGenDecay::makeHepMC( EvtParticle * theEvtGenPart ,
-                                   HepMC::GenParticle * theMother ,
+                                   const HepMC3::GenParticlePtr & theMother ,
                                    const Gaudi::LorentzVector & theOrigin ,
                                    int targetId ) const {
+
   if ( 0 != theEvtGenPart->getNDaug() ) {
     // Find the vertex
     // In EvtGen all positions are defined with respect to the
@@ -381,8 +319,7 @@ StatusCode EvtGenDecay::makeHepMC( EvtParticle * theEvtGenPart ,
 
     // Create a new vertex corresponding to the decay vertex of
     // theMother and add it to theEvent
-    HepMC::GenVertex * end_vtx = 
-      new HepMC::GenVertex( HepMC::FourVector( x , y , z , t ) ) ;
+    auto end_vtx = std::make_shared<HepMC3::GenVertex>( HepMC3::FourVector( x , y , z , t ) ) ;
     theMother -> parent_event() -> add_vertex( end_vtx ) ;
     end_vtx->add_particle_in( theMother ) ;
     
@@ -396,10 +333,9 @@ StatusCode EvtGenDecay::makeHepMC( EvtParticle * theEvtGenPart ,
       double pz = momentum . get( 3 ) * Gaudi::Units::GeV ;
       
       int id = EvtPDL::getStdHep( theEvtGenPart->getDaug( it )->getId() ) ;
-      int status = LHCb::HepMCEvent::DecayedByDecayGen ;
+      int status = HepMC3::Status::DecayedByDecayGen ;
       
-      HepMC::GenParticle * prod_part = new
-        HepMC::GenParticle( HepMC::FourVector(px,py,pz,e) , id , status ) ;
+      auto prod_part = std::make_shared<HepMC3::GenParticle>( HepMC3::FourVector(px,py,pz,e) , id , status ) ;
       
       end_vtx->add_particle_out( prod_part ) ;
       
@@ -416,13 +352,13 @@ StatusCode EvtGenDecay::makeHepMC( EvtParticle * theEvtGenPart ,
           if ( theEvtGenPart->getDaug(it)->getNDaug() > 0 ) 
             prod_part -> 
               set_status
-              ( LHCb::HepMCEvent::DecayedByDecayGenAndProducedByProdGen ) ;
-          else prod_part -> set_status( LHCb::HepMCEvent::StableInDecayGen ) ;
+              ( HepMC3::Status::DecayedByDecayGenAndProducedByProdGen ) ;
+          else prod_part -> set_status( HepMC3::Status::StableInDecayGen ) ;
         }
     }
   }
   else {
-    theMother -> set_status( LHCb::HepMCEvent::StableInDecayGen ) ;
+    theMother -> set_status( HepMC3::Status::StableInDecayGen ) ;
   }
   
   return StatusCode::SUCCESS ;
@@ -669,7 +605,7 @@ bool EvtGenDecay::checkGeneric( const EvtId& id ) const {
 //=============================================================================
 // Check if the HepMC particle is a good candidate
 //=============================================================================
-void EvtGenDecay::checkParticle( const HepMC::GenParticle * thePart ) const {
+void EvtGenDecay::checkParticle( const HepMC3::GenParticlePtr & thePart ) const {
   if ( 0 == thePart -> production_vertex() ) 
     Exception( "Trying to decay a particle without production vertex" ) ;
   if ( 0 != thePart -> end_vertex ( ) ) 
@@ -681,9 +617,10 @@ void EvtGenDecay::checkParticle( const HepMC::GenParticle * thePart ) const {
 // Generate with EvtGen
 //=============================================================================
 StatusCode EvtGenDecay::callEvtGen( EvtParticle * &thePart , 
-                                   const HepMC::GenParticle * theHepMCPart ,
+                                   const HepMC3::GenParticlePtr & theHepMCPart ,
                                    const EvtId & eid ) 
 const {
+  std::lock_guard<std::recursive_mutex> locked{m_mutex};
   // Get parameters of particle to generate ( theHepMCPart )
   // Type of particle and 4-momentum
   // The mother is created outside EvtGenDecay
@@ -775,22 +712,5 @@ void EvtGenDecay::setSignal( const int pdgSignal )
   m_signalId = EvtPDL::getId( nameSignal ) ;
 }
 
-//=============================================================================
-// Implementation of class EvtGenGaudiRandomEngine
-//=============================================================================
-//=============================================================================
-// Constructor
-//=============================================================================
-EvtGenGaudiRandomEngine::EvtGenGaudiRandomEngine( IRndmGenSvc* i , 
-                                                  StatusCode & sc ) {
-  // Initialize Random Engine with flat generator
-  sc = m_randomgaudi.initialize( i , Rndm::Flat( 0 , 1 ) ) ;      
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-EvtGenGaudiRandomEngine::~EvtGenGaudiRandomEngine( ) { 
-  m_randomgaudi.finalize( ) ;
-}
-
+/*static*/ std::unique_ptr<EvtGen> EvtGenDecay::m_gen{nullptr};
+/*static*/ std::recursive_mutex EvtGenDecay::m_mutex{};
diff --git a/Gen/Generators/src/component/EvtGenDecay.h b/Gen/LbEvtGen/src/EvtGenDecay.h
similarity index 67%
rename from Gen/Generators/src/component/EvtGenDecay.h
rename to Gen/LbEvtGen/src/EvtGenDecay.h
index c5b4b6491bc9be660f424f922c7f1dc2f7d0f8aa..7aab87f1b2907ae4586b53669ba5144c7b1adddb 100755
--- a/Gen/Generators/src/component/EvtGenDecay.h
+++ b/Gen/LbEvtGen/src/EvtGenDecay.h
@@ -1,6 +1,4 @@
-// $Id: EvtGenDecay.h,v 1.9 2009-03-16 16:53:26 robbep Exp $
-#ifndef GENERATORS_EVTGENDECAY_H
-#define GENERATORS_EVTGENDECAY_H 1
+#pragma once
 
 // Avoid contamination with WINDOWS symbols
 #ifdef WIN32
@@ -35,14 +33,35 @@
 #include "GaudiKernel/Vector4DTypes.h"
 
 // from MCInterfaces
-#include "MCInterfaces/IDecayTool.h"
+#include "GenInterfaces/IDecayTool.h"
 
 // from Generators
-#include "IEvtGenTool.h"
+#include "GaudiKernel/SystemOfUnits.h"
 
 // from EvtGen
 #include "EvtGenBase/EvtId.hh"
 
+// from HepMC
+#include "HepMC3/GenParticle.h"
+#include "HepMC3/GenVertex.h"
+#include "HepMC3/GenEvent.h"
+#include "HepMCUser/Status.h"
+
+// from EvtGen
+#include "EvtGenBase/EvtRandomEngine.hh"
+#include "TRandom.h"
+
+
+class RandomEngineWrapper : public EvtRandomEngine {
+public:
+  virtual ~RandomEngineWrapper() = default;
+  // return a random number using gRandom from ROOT.
+  // The Gaussino global random engine replaces gRandom
+  // to use the correct thread-local engine of the 
+  // respective algorithm call.
+  double random() override { return gRandom->Rndm();}
+};
+
 // forward declarations
 namespace LHCb {
   class ParticleID ;
@@ -50,7 +69,6 @@ namespace LHCb {
 
 class EvtGen ;
 class EvtParticle ;
-class EvtRandomEngine ;
 
 /** @class EvtGenDecay EvtGenDecay.h "EvtGenDecay.h"
  *
@@ -60,13 +78,12 @@ class EvtRandomEngine ;
  *  @author Patrick Robbe
  *  @date   2003-10-15
  */
-class EvtGenDecay : public GaudiTool, virtual public IDecayTool {
+class EvtGenDecay : public extends<GaudiTool, IDecayTool> {
 public:
-  /// Standard constructor
-  EvtGenDecay( const std::string& type, const std::string& name,
-              const IInterface* parent);
 
-  virtual ~EvtGenDecay( ) ; ///< Destructor
+  using extends::extends;
+
+  virtual ~EvtGenDecay( ) = default; ///< Destructor
 
   /** Initialize method.
    *  In initialization:
@@ -81,16 +98,16 @@ public:
   /// Finalize method
   StatusCode finalize() override;
 
-  /// Implements IDecayTool::generateDecay
-  StatusCode generateDecay( HepMC::GenParticle * theMother ) const override;
+  StatusCode generateDecay( const HepMC3::GenParticlePtr & theMother ,
+                                    HepRandomEnginePtr & engine ) const override;
 
-  /// Implements IDecayTool::generateSignalDecay
-  StatusCode generateSignalDecay( HepMC::GenParticle * theMother ,
-                                  bool & flip ) const override;
+  StatusCode generateSignalDecay( const HepMC3::GenParticlePtr& theMother ,
+                                  bool & flip ,
+                                  HepRandomEnginePtr & engine ) const override;
 
-  /// Implements IDecayTool::generateDecayWithLimit
-  StatusCode generateDecayWithLimit( HepMC::GenParticle * theMother,
-                                     const int targetId ) const override;
+  StatusCode generateDecayWithLimit( const HepMC3::GenParticlePtr & theMother ,
+                                     const int targetId ,
+                                     HepRandomEnginePtr & engine ) const override;
 
   /// Implements IDecayTool::enableFlip
   void enableFlip() const override;
@@ -122,7 +139,7 @@ public:
    *         negative)
    */
   StatusCode makeHepMC( EvtParticle * theParticle ,
-                        HepMC::GenParticle * theMother ,
+                        const HepMC3::GenParticlePtr & theMother ,
                         const Gaudi::LorentzVector & theOrigin ,
                         int targetId = -999 )  const ;
 
@@ -133,7 +150,7 @@ public:
    *  @return StatusCode::SUCCESS if no problem
    *  @return StatusCode::ERROR if particle has already an end vertex
    */
-  void checkParticle( const HepMC::GenParticle * theParticle ) const ;
+  void checkParticle( const HepMC3::GenParticlePtr & theParticle ) const ;
 
   /** Call EvtGen to decay a particle
    *  @param[out] thePart the EvtParticle to produce
@@ -144,17 +161,19 @@ public:
    *              example)
    */
   StatusCode callEvtGen( EvtParticle * &thePart ,
-                         const HepMC::GenParticle * theHepMCParticle ,
+                         const HepMC3::GenParticlePtr & theHepMCParticle ,
                          const EvtId & eid ) const ;
 
   /// Return the id of the alias corresponding to the pdg code pdgId
   virtual const EvtId getSignalAlias( int pdgId ) const ;
 
-  EvtGen * m_gen ; ///< EvtGen engine
+  static std::unique_ptr<EvtGen> m_gen; ///< EvtGen engine
 
-  EvtRandomEngine * m_randomEngine ; ///< Random Engine to use in EvtGeni
+  std::unique_ptr<EvtRandomEngine> m_randomEngine ; ///< Random Engine to use in EvtGeni
 
-  IEvtGenTool * m_evtgentool ;
+  // Recursive mutex to be called at the beginning of any of the three public functions for
+  // decaying
+  static std::recursive_mutex m_mutex;
 
 private:
 
@@ -179,50 +198,52 @@ private:
   /// check if id exists in generic decay table
   bool checkGeneric( const EvtId & id ) const ;
 
-  std::string m_decayFile ; ///< Generic decay file name (set by options)
+  ///< Generic decay file name (set by options)
+  Gaudi::Property<std::string> m_decayFile{this, "DecayFile" , "empty"};
 
-  std::string m_userDecay ; ///< User decay file name (set by options)
+  ///< User decay file name (set by options)
+  Gaudi::Property<std::string> m_userDecay{this, "UserDecayFile", "empty"};
 
-  EvtId m_signalId ; /// EvtGen Id of signal ID
+  EvtId m_signalId{-1,-1} ; /// EvtGen Id of signal ID
 
   /// Do not erase temporary evt.pdl particle property file (set by options)
-  bool  m_keepTempEvtFile ;
+  Gaudi::Property<bool> m_keepTempEvtFile{this, "KeepTempEvtFile", false};
 
   /// Minimum value for ctau. Below ctau is set to 0.
-  double m_minctau ;
+  double m_minctau{ 1.e-4 * Gaudi::Units::mm };
 
   /// Minimum value for ctau. Above ctau is set to 0.
-  double m_maxctau ;
+  double m_maxctau{ 1.e+16 * Gaudi::Units::mm };
 
   /// Minimum value for width. Below it is set to 0.
-  double m_minwidth ;
+  double m_minwidth{ 1.5e-6 * Gaudi::Units::GeV } ;
 
   /// Unit for TAULA output
-  int m_taulaUnit ;
+  int m_taulaUnit{6};
 
   /// Unit for PHOTOS output
-  int m_photosUnit ;
+  int m_photosUnit{6};
 
   /// Flag for polarized Lambda_b production (set by options)
-  bool m_generatePolLambdab ;
+  Gaudi::Property<bool> m_generatePolLambdab{this, "PolarizedLambdad", false};
 
   /// Lambda_b transverse polarisation
-  double m_lambdabPol; 
+  Gaudi::Property<double> m_lambdabPol{this, "TransverseLambdabPol", 1.0};
 
   /// Flag for polarized charmonium production (set by options)
-  bool m_generatePolCharmonium ;
+  Gaudi::Property<bool> m_generatePolCharmonium{this, "PolarizedCharmonium", false};
 
   /// Real part of spin matrix for helicity 0 for charmonium polarization
-  double m_realHelZero ;
+  Gaudi::Property<double> m_realHelZero{this, "RealHelZero", 1.};
 
   /// Imaginary part of spin matrix for helicity 0 for charmonium polarization
-  double m_imHelZero ;
+  Gaudi::Property<double> m_imHelZero{this, "ImHelZero", 0.};
 
   /// Real part of spin matrix for helicity 1 for charmonium polarization
-  double m_realHelOne ;
+  Gaudi::Property<double> m_realHelOne{this, "RealHelOne", 1.};
 
   /// Imaginary part of spin matrix for helicity 1 for charmonium polarization
-  double m_imHelOne ;
+  Gaudi::Property<double> m_imHelOne{this, "RealHelOne", 1.};
 };
 
 //#include "EvtGenBase/EvtIncoherentMixing.hh"
@@ -243,36 +264,3 @@ inline void EvtGenDecay::disableFlip() const {
 //  EvtIncoherentMixing::disableFlip() ;
 }
 
-#include "GaudiKernel/RndmGenerators.h"
-
-// from EvtGen
-#include "EvtGenBase/EvtRandomEngine.hh"
-
-// forward declaration
-class IRndmGenSvc ;
-/** @class EvtGenGaudiRandomEngine
- *  interface to GaudiRandomEngine random engine which will be used inside
- *  EvtGen.
- */
-class EvtGenGaudiRandomEngine : public EvtRandomEngine {
-public:
-  /// Constructor
-  EvtGenGaudiRandomEngine( IRndmGenSvc* i , StatusCode & sc ) ;
-
-  /// Destructor
-  ~EvtGenGaudiRandomEngine ( ) ;
-
-  /// return a random number from the Gaudi engine
-  double random() override;
-
-private:
-  /// Gaudi random engine common to all Gauss algorithms
-  Rndm::Numbers m_randomgaudi ;
-} ;
-
-//=============================================================================
-// Return random number
-//=============================================================================
-inline double EvtGenGaudiRandomEngine::random() { return m_randomgaudi() ; }
-
-#endif // GENERATORS_EVTGENDECAY_H
diff --git a/Gen/Generators/src/component/EvtGenDecayWithCutTool.cpp b/Gen/LbEvtGen/src/EvtGenDecayWithCutTool.cpp
similarity index 57%
rename from Gen/Generators/src/component/EvtGenDecayWithCutTool.cpp
rename to Gen/LbEvtGen/src/EvtGenDecayWithCutTool.cpp
index 412db4ff422a85ea0136b42568708d7524a5d250..e34020f8e66527b3d9867de8d5fbcceae44fbf82 100755
--- a/Gen/Generators/src/component/EvtGenDecayWithCutTool.cpp
+++ b/Gen/LbEvtGen/src/EvtGenDecayWithCutTool.cpp
@@ -6,15 +6,13 @@
 #include <iostream>
 
 // from LHCb
-#include "GenEvent/HepMCUtils.h"
+#include "HepMCUtils/HepMCUtils.h"
 
 // from HepMC
 #include "HepMC/GenEvent.h"
 #include "HepMC/GenParticle.h"
 #include "HepMC/GenVertex.h"
 
-#include "MCInterfaces/IGenCutTool.h"
-
 //-----------------------------------------------------------------------------
 // Implementation file for class : EvtGenDecayWithCutTool
 //
@@ -25,43 +23,20 @@
 
 DECLARE_COMPONENT( EvtGenDecayWithCutTool )
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-EvtGenDecayWithCutTool::EvtGenDecayWithCutTool( const std::string& type, const std::string& name,
-                                                const IInterface* parent )
-    : EvtGenDecay( type, name, parent )
-{
-  // Declare IEvtGenDecay interface
-  declareInterface<IDecayTool>( this );
-  // Name of the cut tool to be used
-  declareProperty( "CutTool", m_cutToolName = "" );
-}
-
-//=============================================================================
-// Initialize method
-//=============================================================================
-StatusCode EvtGenDecayWithCutTool::initialize()
-{
-  StatusCode sc = EvtGenDecay::initialize();
-  if ( sc.isFailure() ) return sc;
-
-  if ( m_cutToolName != "" ) m_cutTool = tool<IGenCutTool>( m_cutToolName, this );
-
-  return StatusCode::SUCCESS;
-}
 
 //=============================================================================
 // Generate a Decay tree from a particle theMother in the event theEvent
 // Repeat until it passes the the cut;
 //=============================================================================
-StatusCode EvtGenDecayWithCutTool::generateSignalDecay( HepMC::GenParticle* theMother, bool& flip ) const
-{
+StatusCode EvtGenDecayWithCutTool::generateSignalDecay( 
+    const HepMC3::GenParticlePtr& theMother ,
+    bool & flip ,
+    HepRandomEnginePtr & engine) const {
   int counter    = 0;
   bool found_one = false;
   while ( !found_one ) {
     HepMCUtils::RemoveDaughters( theMother );
-    StatusCode sc = EvtGenDecay::generateSignalDecay( theMother, flip );
+    StatusCode sc = EvtGenDecay::generateSignalDecay( theMother, flip, engine );
     if ( sc.isFailure() ) {
       return sc;
     }
diff --git a/Gen/Generators/src/component/EvtGenDecayWithCutTool.h b/Gen/LbEvtGen/src/EvtGenDecayWithCutTool.h
similarity index 68%
rename from Gen/Generators/src/component/EvtGenDecayWithCutTool.h
rename to Gen/LbEvtGen/src/EvtGenDecayWithCutTool.h
index 921270a706e6d0813101ad48aa7c742df5f49b8b..b3af9dbe9917bffb5ee62ea9dcc6926314e45b38 100755
--- a/Gen/Generators/src/component/EvtGenDecayWithCutTool.h
+++ b/Gen/LbEvtGen/src/EvtGenDecayWithCutTool.h
@@ -1,8 +1,7 @@
 #pragma once
 // from Generators
 #include "EvtGenDecay.h"
-
-class IGenCutTool;
+#include "GenInterfaces/IGenCutTool.h"
 
 /** @class EvtGenDecayWithCutTool EvtGenDecayWithCutTool.h "EvtGenDecayWithCutTool.h"
  *
@@ -27,20 +26,15 @@ class IGenCutTool;
 class EvtGenDecayWithCutTool : public EvtGenDecay
 {
 public:
-  /// Standard constructor
-  EvtGenDecayWithCutTool( const std::string& type, const std::string& name, const IInterface* parent );
+  using EvtGenDecay::EvtGenDecay;
 
-  /** Initialize method.
-   *  Runs the EvtGenDecay initialization and gets the cut tool.
-   */
-  StatusCode initialize() override;
 
   /// Implements IDecayTool::generateSignalDecay
   // Runs EvtGenDecay::generateSignalDecay until a decay passes the provided cut.
-  StatusCode generateSignalDecay( HepMC::GenParticle* theMother, bool& flip ) const override;
+  StatusCode generateSignalDecay( const HepMC3::GenParticlePtr& theMother ,
+                                  bool & flip ,
+                                  HepRandomEnginePtr & engine ) const override;
 
 private:
-  std::string m_cutToolName = ""; ///< Name of the cut tool to be applied at each decay attempt.
-
-  IGenCutTool* m_cutTool = nullptr;
+  ToolHandle<IGenCutTool> m_cutTool{this, "CutTool", ""};
 };
diff --git a/Gen/Generators/src/component/EvtGenInPhSpDecay.cpp b/Gen/LbEvtGen/src/EvtGenInPhSpDecay.cpp
similarity index 86%
rename from Gen/Generators/src/component/EvtGenInPhSpDecay.cpp
rename to Gen/LbEvtGen/src/EvtGenInPhSpDecay.cpp
index 41693c7383ce0797c457482a48f4a5b9700ffa17..19bf740dd380fbfb7fcbd60cfe2db7cafd198569 100644
--- a/Gen/Generators/src/component/EvtGenInPhSpDecay.cpp
+++ b/Gen/LbEvtGen/src/EvtGenInPhSpDecay.cpp
@@ -37,7 +37,6 @@
 #include "EvtGenModels/EvtModelRegExtras.hh"
 
 #include "Generators/StreamForGenerator.h"
-#include "Generators/IProductionTool.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : EvtGenInPhSpDecay
@@ -48,32 +47,6 @@
 
 DECLARE_COMPONENT( EvtGenInPhSpDecay )
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-EvtGenInPhSpDecay::EvtGenInPhSpDecay( const std::string& type,
-                          const std::string& name,
-                          const IInterface* parent )
-  : EvtGenDecay ( type, name , parent ),
-    // name of q2 parameter file
-    m_q2mapfile ( "" )  ,
-    // statistics
-    m_tot_calls ( 0.0 ) ,
-    m_num_evts ( 0.0 ) ,
-    m_ave_eff ( 0.0 ) 
-{
-    // Declare IEvtGenInPhSpDecay interface
-    declareInterface<IDecayTool>( this ) ;
-    //number of bins for q2
-    declareProperty("NumQ2Bins" , m_q2nbins = 100 ) ;
-    declareProperty("MaxQ2Bins" , m_q2nmax  = 19 ) ;
-    declareProperty("MaxEvtGenCalls" , m_limit  = 1000 ) ;
-    declareProperty("ParamFile", m_prefix = "Q2Param" ) ;
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-EvtGenInPhSpDecay::~EvtGenInPhSpDecay( ) { }
 //=============================================================================
 // Initialize method
 //=============================================================================
@@ -160,7 +133,7 @@ StatusCode EvtGenInPhSpDecay::loadMap( ) {
 // Generate with EvtGen until conditions are satisfied
 //=============================================================================
 StatusCode EvtGenInPhSpDecay::doEvtGenLoop( EvtParticle* & part , 
-                                            HepMC::GenParticle * &theMother ,
+                                            const HepMC3::GenParticlePtr &theMother ,
                                             const EvtId &pid ) const
 {
     //loop to re-decay particle until phase space conditions are satisfied
@@ -245,8 +218,9 @@ StatusCode EvtGenInPhSpDecay::doEvtGenLoop( EvtParticle* & part ,
 //=============================================================================
 // Generate a Decay tree from a particle theMother in the event theEvent
 //=============================================================================
-StatusCode EvtGenInPhSpDecay::generateSignalDecay( HepMC::GenParticle * theMother ,
-                                             bool & flip) const {
+StatusCode EvtGenInPhSpDecay::generateSignalDecay( const HepMC3::GenParticlePtr& theMother ,
+                                  bool & flip ,
+                                  HepRandomEnginePtr &) const {
   // If particle already has daughters, return now
   if ( 0 != theMother -> end_vertex() ) {
     flip = false ;
@@ -276,7 +250,7 @@ StatusCode EvtGenInPhSpDecay::generateSignalDecay( HepMC::GenParticle * theMothe
   // correct vertex for daughter particles of theMother
   // because EvtGen gives position with respect to the "root" particle
   // This reference position is production vertex of theMother
-  HepMC::GenVertex * PV = theMother -> production_vertex() ;
+  auto PV = theMother -> production_vertex() ;
   Gaudi::LorentzVector theOriginPosition( PV -> position() ) ;
   
   // Fill HepMC event theEvent with EvtGen decay tree part
diff --git a/Gen/Generators/src/component/EvtGenInPhSpDecay.h b/Gen/LbEvtGen/src/EvtGenInPhSpDecay.h
similarity index 56%
rename from Gen/Generators/src/component/EvtGenInPhSpDecay.h
rename to Gen/LbEvtGen/src/EvtGenInPhSpDecay.h
index a5a0a753559f99c6a2d29166cd176133c95915b8..6bbc7e5a776a6897d204c11d52d990b3a1304965 100644
--- a/Gen/Generators/src/component/EvtGenInPhSpDecay.h
+++ b/Gen/LbEvtGen/src/EvtGenInPhSpDecay.h
@@ -12,13 +12,11 @@
  *  @author Alex Shires
  *  @date   2011-08-16
  */
-class EvtGenInPhSpDecay : public EvtGenDecay, virtual public IDecayTool {
+class EvtGenInPhSpDecay : public extends<EvtGenDecay, IDecayTool> {
 public:
-  /// Standard constructor
-  EvtGenInPhSpDecay( const std::string& type, const std::string& name,
-              const IInterface* parent);
+  using extends::extends;
 
-  virtual ~EvtGenInPhSpDecay( ) ; ///< Destructor
+  virtual ~EvtGenInPhSpDecay( ) = default; ///< Destructor
 
   /** Initialize method.
    *  In initialization:
@@ -31,37 +29,39 @@ public:
   StatusCode finalize() override;
 
   /// Implements IDecayTool::generateSignalDecay
-  StatusCode generateSignalDecay( HepMC::GenParticle * theMother ,
-                                  bool & flip ) const override;
+  StatusCode generateSignalDecay( const HepMC3::GenParticlePtr& theMother ,
+                                  bool & flip ,
+                                  HepRandomEnginePtr & engine ) const override;
+
 
  private:
 
   StatusCode doEvtGenLoop( EvtParticle* &thePart ,
-                           HepMC::GenParticle * &theHepMCParticle ,
+                           const HepMC3::GenParticlePtr &theHepMCParticle ,
                            const EvtId & eid ) const ;
 
   /// load qsquared map
   StatusCode loadMap(void ) ;
 
   /// File name of parameter file
-  boost::filesystem::path m_q2mapfile ;
+  boost::filesystem::path m_q2mapfile{""};
 
   std::string m_q2mapfilename ;
-  std::string m_prefix ;
+  Gaudi::Property<std::string> m_prefix{this, "ParamFile", "Q2Param"};
 
   // number of bins in q2
-  int m_q2nbins ;
-  int m_q2nmax ;
+  Gaudi::Property<int> m_q2nbins{this, "NumQ2Bins", 100};
+  Gaudi::Property<int> m_q2nmax{this, "MaxQ2Bins", 19};
 
   //vector for q2 values
   std::vector<double> m_q2mapvec ;
 
   //statistics
-  double m_tot_calls ;
-  double m_num_evts ;
-  double m_ave_eff ;
+  double m_tot_calls{0} ;
+  double m_num_evts{0} ;
+  double m_ave_eff{0} ;
 
-  int m_limit ;
+  Gaudi::Property<int> m_limit{this, "MaxEvtGenCalls", 1000};
 
 };
 
diff --git a/Gen/LbGenXicc/.gaudi_project_ignore b/Gen/LbGenXicc/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbHard/.gaudi_project_ignore b/Gen/LbHard/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbHerwigpp/.gaudi_project_ignore b/Gen/LbHerwigpp/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbHidValley/.gaudi_project_ignore b/Gen/LbHidValley/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbHijing/.gaudi_project_ignore b/Gen/LbHijing/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbLPair/.gaudi_project_ignore b/Gen/LbLPair/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbMIB/.gaudi_project_ignore b/Gen/LbMIB/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbOniaPairs/.gaudi_project_ignore b/Gen/LbOniaPairs/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbPGuns/.gaudi_project_ignore b/Gen/LbPGuns/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbPowheg/.gaudi_project_ignore b/Gen/LbPowheg/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbPythia/.gaudi_project_ignore b/Gen/LbPythia/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbPythia8/.gaudi_project_ignore b/Gen/LbPythia8/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbStarLight/.gaudi_project_ignore b/Gen/LbStarLight/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/LbSuperChic2/.gaudi_project_ignore b/Gen/LbSuperChic2/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Gen/SuperChic2/.gaudi_project_ignore b/Gen/SuperChic2/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/HC/.gaudi_project_ignore b/HC/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Muon/MuonMoniSim/CMakeLists.txt b/Muon/MuonMoniSim/CMakeLists.txt
index 94e523710f7b33dd1656a2791ae515442538973d..7084baaf26a85eead5a357c256878c8fabd44a95 100644
--- a/Muon/MuonMoniSim/CMakeLists.txt
+++ b/Muon/MuonMoniSim/CMakeLists.txt
@@ -14,7 +14,7 @@ find_package(ROOT)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS})
 
 gaudi_add_module(MuonMoniSim
-                 src/*.cpp
+                 src/MuonHitChecker.cpp
                  INCLUDE_DIRS AIDA
                  LINK_LIBRARIES MuonDetLib MCEvent GaudiAlgLib)
 
diff --git a/Muon/MuonMoniSim/src/MuonHitChecker.cpp b/Muon/MuonMoniSim/src/MuonHitChecker.cpp
index c0cd87db13a2fdce63c183f88f0016b0d11e2943..27c01c6c84cbef37689ef5476507c9cf712ff7fc 100755
--- a/Muon/MuonMoniSim/src/MuonHitChecker.cpp
+++ b/Muon/MuonMoniSim/src/MuonHitChecker.cpp
@@ -1,12 +1,12 @@
 // $Id: MuonHitChecker.cpp,v 1.12 2009-06-15 16:57:49 gcorti Exp $
-// Include files 
+// Include files
 
 // from Gaudi
 
 // local
-#include "MuonDet/DeMuonDetector.h"
 #include "MuonHitChecker.h"
-#include "Event/MCHeader.h"
+#include "MuonDet/DeMuonDetector.h"
+#include "AIDA/IHistogram1D.h"
 
 //-----------------------------------------------------------------------------
 // This File contains the monitor for muon Hit system
@@ -17,265 +17,250 @@
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algortihm Factory
-DECLARE_COMPONENT( MuonHitChecker )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-MuonHitChecker::MuonHitChecker( const std::string& name,
-				ISvcLocator* pSvcLocator)
-  : GaudiTupleAlg ( name , pSvcLocator )   
-{
-  declareProperty( "DetailedMonitor"         ,m_detailedMonitor=false );
-  declareProperty( "MCHeader" , m_mcHeader = LHCb::MCHeaderLocation::Default ) ;
-  declareProperty( "MuonHits" , m_muonHits = LHCb::MCHitLocation::Muon ) ;
-  m_hit_outside_gaps=0;
-  
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-MuonHitChecker::~MuonHitChecker() {}
+DECLARE_COMPONENT(MuonHitChecker)
 
-//=============================================================================
-// Initialisation. Check parameters
-//=============================================================================
 StatusCode MuonHitChecker::initialize() {
+  StatusCode sc = GaudiHistoAlg::initialize(); // must be executed first
+  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
 
-  StatusCode sc = GaudiTupleAlg::initialize();
-  if (sc.isFailure()){
-    return Error("Failed to initialize", sc);
-  }
-  
-  debug() << "==> Initialise" << endmsg;
-
-  for(int i=0; i<5; i++) {
-    nhit_ri[i] = cnt_ri[i] = 0;
-    for(int j=0; j<4; j++) {
-      nhit[i][j] = cnt[i][j] = 0;
-    }
-  }
-
+  debug() << "==> Initialize" << endmsg;
+  bookHistograms();
   return StatusCode::SUCCESS;
 }
 
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode MuonHitChecker::execute() {
+void MuonHitChecker::operator()(const LHCb::MCHits& hits,
+                                const LHCb::MCHeader& header) const {
 
-  const LHCb::MCHeader* evt = get<LHCb::MCHeader>( m_mcHeader );
-
-  long  m_evt = evt->evtNumber();
+  long m_evt = header.evtNumber();
+  std::lock_guard<std::mutex> guard_lock(m_lazy_lock);
 
   debug() << "==> Execute MuonHitChecker" << endmsg;
   // Header
 
-  int tnhit[5][4];    int tnhit_ri[5];  int tmhit_ri[5];  
-  for(int i=0; i<5; i++) {
-    tnhit_ri[i] = 0; tmhit_ri[i] = 0;
-    for(int j=0; j<4; j++) {
+  int tnhit[5][4];
+  int tnhit_ri[5];
+  int tmhit_ri[5];
+  for (int i = 0; i < 5; i++) {
+    tnhit_ri[i] = 0;
+    tmhit_ri[i] = 0;
+    for (int j = 0; j < 4; j++) {
       tnhit[i][j] = 0;
     }
   }
-  
 
-  std::vector<float> m_sta,m_reg,m_con,m_x,m_y,m_z,m_time;
-  std::vector<float> m_id,m_px,m_py,m_pz,m_E,m_xv,m_yv,m_zv,m_tv, m_mom;
-  std::vector<float> m_ple,m_hen,m_dix,m_dxz,m_dyz;
+  std::vector<float> m_sta, m_reg, m_con, m_x, m_y, m_z, m_time;
+  std::vector<float> m_id, m_px, m_py, m_pz, m_E, m_xv, m_yv, m_zv, m_tv, m_mom;
+  std::vector<float> m_ple, m_hen, m_dix, m_dxz, m_dyz;
 
-  DeMuonDetector * muonD = getDet<DeMuonDetector>("/dd/Structure/LHCb/DownstreamRegion/Muon"); 
+  DeMuonDetector* muonD =
+      getDet<DeMuonDetector>("/dd/Structure/LHCb/DownstreamRegion/Muon");
 
   // get the MCHits
-  SmartDataPtr<LHCb::MCHits> hits(eventSvc() , m_muonHits );
-  
-  LHCb::MCHits::const_iterator iter;
   int MyDetID;
   // Loop over Muon Hits of given type
-  if(hits!=0){
-    for (iter = hits->begin(); iter < hits->end();iter++){
-      
-      MyDetID = (*iter)->sensDetID();
-      if(MyDetID<0) m_hit_outside_gaps++;
-      if(MyDetID<0) continue;
-      
-      //Needs to extract info from sens ID      
-      int station = muonD->stationID(MyDetID);  
-      
-      int region  = muonD->regionID(MyDetID);   
-
-      //int chamber = muonD->chamberID(MyDetID);        
-
-      debug()<<" Station, Region :: " <<station<<" "<<region<<endmsg;
-  
-      float xpos=((*iter)->entry().x()+(*iter)->exit().x())/2.0;
-      float ypos=((*iter)->entry().y()+(*iter)->exit().y())/2.0;
-      float zpos=((*iter)->entry().z()+(*iter)->exit().z())/2.0;
-      float time=(*iter)->time();
-      
-      //New monitored quantities
-      float plen=(*iter)->pathLength();
-      float hene=(*iter)->energy();
-      float hdis=(*iter)->displacement().x();
-      float hdxz=(*iter)->dxdz();
-      float hdyz=(*iter)->dydz();
-      
-      //Temporary monitoring (need to check if already available)
-      m_ple.push_back(plen);
-      m_hen.push_back(hene);
-      m_dix.push_back(hdis);
-      m_dxz.push_back(hdxz);
-      m_dyz.push_back(hdyz);
-      
-      double tof=time-sqrt(xpos*xpos+ypos*ypos+zpos*zpos)/300.0;
-      if(tof<0.1)tof=0.1;
-      float r=sqrt(xpos*xpos+ypos*ypos);
-      
-      m_sta.push_back(station);
-      m_reg.push_back(region);
-      //Only Geant Container available
-      m_con.push_back(0);
-      
-      m_x.push_back(xpos); m_y.push_back(ypos); m_z.push_back(zpos);
-      m_time.push_back(time);
-      
-      //Fill some histos	  
-      int hh =station*4+region;
-      if (fullDetail() == true) {
-	plot( r, hh+2000, "Radial Multiplicity", 0., 6000.,200 );
-	plot(tof,hh+1000, "Time multiplicity",   0.,  100.,200 ); 
+  for (auto& hit : hits) {
+    MyDetID = hit->sensDetID();
+    if (MyDetID < 0) m_hit_outside_gaps++;
+    if (MyDetID < 0) continue;
+
+    // Needs to extract info from sens ID
+    int station = muonD->stationID(MyDetID);
+
+    int region = muonD->regionID(MyDetID);
+
+    // int chamber = muonD->chamberID(MyDetID);
+
+    debug() << " Station, Region :: " << station << " " << region << endmsg;
+
+    float xpos = (hit->entry().x() + hit->exit().x()) / 2.0;
+    float ypos = (hit->entry().y() + hit->exit().y()) / 2.0;
+    float zpos = (hit->entry().z() + hit->exit().z()) / 2.0;
+    float time = hit->time();
+
+    // New monitored quantities
+    float plen = hit->pathLength();
+    float hene = hit->energy();
+    float hdis = hit->displacement().x();
+    float hdxz = hit->dxdz();
+    float hdyz = hit->dydz();
+
+    // Temporary monitoring (need to check if already available)
+    m_ple.push_back(plen);
+    m_hen.push_back(hene);
+    m_dix.push_back(hdis);
+    m_dxz.push_back(hdxz);
+    m_dyz.push_back(hdyz);
+
+    double tof = time - sqrt(xpos * xpos + ypos * ypos + zpos * zpos) / 300.0;
+    if (tof < 0.1) tof = 0.1;
+    float r = sqrt(xpos * xpos + ypos * ypos);
+
+    m_sta.push_back(station);
+    m_reg.push_back(region);
+    // Only Geant Container available
+    m_con.push_back(0);
+
+    m_x.push_back(xpos);
+    m_y.push_back(ypos);
+    m_z.push_back(zpos);
+    m_time.push_back(time);
+
+    // Fill some histos
+    unsigned int hh = station * m_nBookRegions + region;
+    if (fullDetail() == true) {
+      if(m_histos.find(hh+2000) != std::end(m_histos)){
+        m_histos[hh + 2000]->fill(r);
+      }
+      if(m_histos.find(hh+1000) != std::end(m_histos)){
+      m_histos[hh + 1000]->fill(tof);
       }
-      
-      //MC truth
-      const LHCb::MCParticle* particle=(*iter)->mcParticle();
-      if(particle){            
-	if(abs(particle->particleID().pid())<100000){
-	  m_id.push_back(particle->particleID().pid());
-	}
-	
-	m_px.push_back(particle->momentum().px());
-	m_py.push_back(particle->momentum().py());
-	//Pz sign tells you the particle direction
-	m_pz.push_back(particle->momentum().pz());
-	m_E.push_back(particle->momentum().e());
-	
-	//Particle Vertex studies	    
-	m_xv.push_back(particle->originVertex()->position().x());
-	m_yv.push_back(particle->originVertex()->position().y());
-	m_zv.push_back(particle->originVertex()->position().z());
-	m_tv.push_back(particle->originVertex()->time());
-	
-	const LHCb::MCParticle * moth=particle->mother();
-	if(moth && (abs(moth->particleID().pid())<100000)){
-	  m_mom.push_back(moth->particleID().pid()); 
-	} else {
-	  m_mom.push_back(0);
-	}
+    }
+
+    // MC truth
+    const LHCb::MCParticle* particle = hit->mcParticle();
+    if (particle) {
+      if (abs(particle->particleID().pid()) < 100000) {
+        m_id.push_back(particle->particleID().pid());
+      }
+
+      m_px.push_back(particle->momentum().px());
+      m_py.push_back(particle->momentum().py());
+      // Pz sign tells you the particle direction
+      m_pz.push_back(particle->momentum().pz());
+      m_E.push_back(particle->momentum().e());
+
+      // Particle Vertex studies
+      m_xv.push_back(particle->originVertex()->position().x());
+      m_yv.push_back(particle->originVertex()->position().y());
+      m_zv.push_back(particle->originVertex()->position().z());
+      m_tv.push_back(particle->originVertex()->time());
+
+      const LHCb::MCParticle* moth = particle->mother();
+      if (moth && (abs(moth->particleID().pid()) < 100000)) {
+        m_mom.push_back(moth->particleID().pid());
       } else {
-	m_id.push_back(0);	    m_px.push_back(0);	    m_py.push_back(0);
-	m_pz.push_back(0);	    m_E.push_back(0);	    m_xv.push_back(0);
-	m_yv.push_back(0);	    m_zv.push_back(0);	    m_tv.push_back(0);
-	m_mom.push_back(0);
-      }          
-      
-      if(abs(particle->particleID().pid()) == 13) tmhit_ri[station]++;
-      tnhit[station][region]++;
-      tnhit_ri[station]++;
+        m_mom.push_back(0);
+      }
+    } else {
+      m_id.push_back(0);
+      m_px.push_back(0);
+      m_py.push_back(0);
+      m_pz.push_back(0);
+      m_E.push_back(0);
+      m_xv.push_back(0);
+      m_yv.push_back(0);
+      m_zv.push_back(0);
+      m_tv.push_back(0);
+      m_mom.push_back(0);
     }
+
+    if (abs(particle->particleID().pid()) == 13) tmhit_ri[station]++;
+    tnhit[station][region]++;
+    tnhit_ri[station]++;
   }
 
-  for(int s=0; s<5; s++) {
-    //Looking at mean number of hits (intregrated over regions)
+  for (int s = 0; s < 5; s++) {
+    // Looking at mean number of hits (intregrated over regions)
     cnt_ri[s]++;
-    nhit_ri[s]+= tnhit_ri[s];
-    for(int r=0; r<4; r++) {
-      //Looking at mean number of hits
+    nhit_ri[s] += tnhit_ri[s];
+    for (int r = 0; r < 4; r++) {
+      // Looking at mean number of hits
       cnt[s][r]++;
-      nhit[s][r]+= tnhit[s][r];
-    }  
-  }  
+      nhit[s][r] += tnhit[s][r];
+    }
+  }
 
   // book vectors of histos
-  if(m_detailedMonitor == true) { 
-
-    Tuple nt1 = nTuple(1,"MC HITS",CLID_ColumnWiseTuple);
-    info() << "Doing ntuple stuff"
-           << endmsg;
+  if (m_detailedMonitor == true) {
+    Tuple nt1 = nTuple(1, "MC HITS", CLID_ColumnWiseTuple);
+    info() << "Doing ntuple stuff" << endmsg;
     //    nt1->column("Run", m_run,0,1000000);
-    int pippo=m_evt;
-    nt1->column("Event",pippo,0,10000);
-
-    nt1->farray("is", m_sta ,"Nhits",1000);
-    nt1->farray("ir", m_reg ,"Nhits",1000);
-    nt1->farray("ic", m_con ,"Nhits",1000);
-    nt1->farray("x",  m_x   ,"Nhits",1000);
-    nt1->farray("y",  m_y   ,"Nhits",1000);
-    nt1->farray("z",  m_z   ,"Nhits",1000);
-    nt1->farray("t",  m_time,"Nhits",1000);
-    nt1->farray("id", m_id  ,"Nhits",1000);
-    nt1->farray("px", m_px  ,"Nhits",1000);
-    nt1->farray("py", m_py  ,"Nhits",1000);
-    nt1->farray("pz", m_pz  ,"Nhits",1000);
-    nt1->farray("E",  m_E   ,"Nhits",1000);
-    nt1->farray("xv", m_xv  ,"Nhits",1000);
-    nt1->farray("yv", m_yv  ,"Nhits",1000);
-    nt1->farray("zv", m_zv  ,"Nhits",1000);
-    nt1->farray("tv", m_tv  ,"Nhits",1000);
-    nt1->farray("idm",m_mom ,"Nhits",1000);
-    nt1->farray("pl", m_ple ,"Nhits",1000);
-    nt1->farray("he", m_hen ,"Nhits",1000);
-    nt1->farray("dx", m_dix ,"Nhits",1000);
-    nt1->farray("xz", m_dxz ,"Nhits",1000);
-    nt1->farray("yz", m_dyz ,"Nhits",1000);
-    nt1->write(); 
-  }
-   
+    int pippo = m_evt;
+    nt1->column("Event", pippo, 0, 10000);
 
-  return StatusCode::SUCCESS;
+    nt1->farray("is", m_sta, "Nhits", 1000);
+    nt1->farray("ir", m_reg, "Nhits", 1000);
+    nt1->farray("ic", m_con, "Nhits", 1000);
+    nt1->farray("x", m_x, "Nhits", 1000);
+    nt1->farray("y", m_y, "Nhits", 1000);
+    nt1->farray("z", m_z, "Nhits", 1000);
+    nt1->farray("t", m_time, "Nhits", 1000);
+    nt1->farray("id", m_id, "Nhits", 1000);
+    nt1->farray("px", m_px, "Nhits", 1000);
+    nt1->farray("py", m_py, "Nhits", 1000);
+    nt1->farray("pz", m_pz, "Nhits", 1000);
+    nt1->farray("E", m_E, "Nhits", 1000);
+    nt1->farray("xv", m_xv, "Nhits", 1000);
+    nt1->farray("yv", m_yv, "Nhits", 1000);
+    nt1->farray("zv", m_zv, "Nhits", 1000);
+    nt1->farray("tv", m_tv, "Nhits", 1000);
+    nt1->farray("idm", m_mom, "Nhits", 1000);
+    nt1->farray("pl", m_ple, "Nhits", 1000);
+    nt1->farray("he", m_hen, "Nhits", 1000);
+    nt1->farray("dx", m_dix, "Nhits", 1000);
+    nt1->farray("xz", m_dxz, "Nhits", 1000);
+    nt1->farray("yz", m_dyz, "Nhits", 1000);
+    nt1->write();
+  }
 }
 //=============================================================================
 //  Finalize
 //=============================================================================
 StatusCode MuonHitChecker::finalize() {
- info() << "-----------------------------------------------------------------"
-	 << endmsg;
+  info() << "-----------------------------------------------------------------"
+         << endmsg;
   info() << "       Muon Monitoring Table " << endmsg;
   info() << "-----------------------------------------------------------------"
-	 << endmsg;
-  info()<<" M1        M2        M3        M4        M5 "<<endmsg;
-  for(int r=0; r<4; r++) {
-    for(int s=0; s<5; s++) {
-      if(cnt[s][r])  {
-	info()<<format("%5.3lf  ",(double)nhit[s][r]/cnt[s][r]);
-	//	info()<<(double)nhit[s][r]/cnt[s][r]<<"     ";
+         << endmsg;
+  info() << " M1        M2        M3        M4        M5 " << endmsg;
+  for (int r = 0; r < 4; r++) {
+    for (int s = 0; s < 5; s++) {
+      if (cnt[s][r]) {
+        info() << format("%5.3lf  ", (double)nhit[s][r] / cnt[s][r]);
+        //	info()<<(double)nhit[s][r]/cnt[s][r]<<"     ";
       } else {
-	info()<<"0.000  ";
+        info() << "0.000  ";
       }
     }
-    info()<<" R"<<r+1<<endmsg;
+    info() << " R" << r + 1 << endmsg;
   }
   info() << "-----------------------------------------------------------------"
-	 << endmsg;
+         << endmsg;
   info() << "-------    Integrated over regions    ---------------------------"
-	 << endmsg;
+         << endmsg;
   info() << "-----------------------------------------------------------------"
-	 << endmsg;
-  for(int s=0; s<5; s++) {
-    if(cnt_ri[s])  {
-      info()<<format("%5.3lf  ",(double)nhit_ri[s]/cnt_ri[s]);
+         << endmsg;
+  for (int s = 0; s < 5; s++) {
+    if (cnt_ri[s]) {
+      info() << format("%5.3lf  ", (double)nhit_ri[s] / cnt_ri[s]);
       //	info()<<(double)nhit[s][r]/cnt[s][r]<<"     ";
     } else {
-      info()<<"0.000  ";
+      info() << "0.000  ";
     }
   }
-  info()<<" allR"<<endmsg;
-  info()<<" number of hits generated outside gaps volume "<<  m_hit_outside_gaps<<endmsg;
-  
-  return StatusCode::SUCCESS; // what was here before but this doesn't finalise the GaudiTupleAlg like in the multiplescattering checker 
-  
-  // return GaudiTupleAlg::finalize();
-}
+  info() << " allR" << endmsg;
+  info() << " number of hits generated outside gaps volume "
+         << m_hit_outside_gaps << endmsg;
 
+  return StatusCode::SUCCESS;  // what was here before but this doesn't finalise
+                               // the GaudiTupleAlg like in the
+                               // multiplescattering checker
 
+  // return GaudiTupleAlg::finalize();
+}
 
+void MuonHitChecker::bookHistograms() {
+  if (!fullDetail()) {
+    return;
+  }
+  for (unsigned int station = 0; station < m_nBookStations; station++) {
+    for (unsigned int region = 0; region < m_nBookRegions; region++) {
+      int hh = station * m_nBookRegions + region;
+      m_histos[hh + 2000] = book(hh + 2000, "Radial Multiplicity", 0., 6000., 200);
+      m_histos[hh + 1000] = book(hh + 1000, "Time multiplicity", 0., 100., 200);
+    }
+  }
+}
diff --git a/Muon/MuonMoniSim/src/MuonHitChecker.h b/Muon/MuonMoniSim/src/MuonHitChecker.h
index 48172606dab6149e5177908cc238bff76651de5d..2dfe3acc5668acdb2ff6158a7e4fd9991f13d67b 100755
--- a/Muon/MuonMoniSim/src/MuonHitChecker.h
+++ b/Muon/MuonMoniSim/src/MuonHitChecker.h
@@ -1,6 +1,4 @@
-// $Id: MuonHitChecker.h,v 1.6 2009-03-26 21:59:02 robbep Exp $
-#ifndef MuonHitChecker_H
-#define MuonHitChecker_H 1
+#pragma once
 
 // Include files
 // from STL
@@ -10,39 +8,58 @@
 #include "GaudiAlg/GaudiTupleAlg.h"
 
 // for Muons
+#include "Event/MCHeader.h"
 #include "Event/MCHit.h"
+#include "GaudiAlg/Consumer.h"
+#include "GaudiAlg/GaudiTupleAlg.h"
 
+namespace AIDA {
+  class IHistogram1D;
+}
 /** @class MuonHitChecker MuonHitChecker.h
  *
  *
  *  @author A Sarti
  *  @date   2005-05-20
+ *  @author Dominik Muller
+ *  @date   2005-05-20
  */
-class MuonHitChecker : public GaudiTupleAlg {
-public:
+class MuonHitChecker
+    : public Gaudi::Functional::Consumer<
+          void(const LHCb::MCHits&, const LHCb::MCHeader&),
+          Gaudi::Functional::Traits::BaseClass_t<GaudiTupleAlg>> {
+  public:
   /// Standard constructor
-  MuonHitChecker( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~MuonHitChecker( ); ///< Destructor
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
+  MuonHitChecker(const std::string& name, ISvcLocator* pSvcLocator)
+      : Consumer(name, pSvcLocator,
+                 {{KeyValue{"MuonHits", LHCb::MCHitLocation::Muon},
+                   KeyValue{"MCHeader", LHCb::MCHeaderLocation::Default}}}) {
+    for (int i = 0; i < 5; i++) {
+      nhit_ri[i] = cnt_ri[i] = 0;
+      for (int j = 0; j < 4; j++) {
+        nhit[i][j] = cnt[i][j] = 0;
+      }
+    }
+  };
 
-  bool m_detailedMonitor; //was in private
+  void operator()(const LHCb::MCHits&, const LHCb::MCHeader&) const override;
+  StatusCode finalize() override;
+  StatusCode initialize() override;
 
-protected:
+  Gaudi::Property<bool> m_detailedMonitor{this, "DetailedMonitor", false};
+  Gaudi::Property<unsigned int> m_nBookStations{this, "NBookStations", 5};
+  Gaudi::Property<unsigned int> m_nBookRegions{this, "NBookRegions", 4};
 
+  protected:
   std::vector<int> m_numberOfGaps;
 
-private:
-
-  int nhit[5][4],cnt[5][4];
-  int nhit_ri[5],cnt_ri[5];
-
+  private:
+  mutable std::mutex m_lazy_lock;
+  mutable int nhit[5][4], cnt[5][4];
+  mutable int nhit_ri[5], cnt_ri[5];
+  mutable std::map<unsigned int, AIDA::IHistogram1D*> m_histos;
 
-  int m_hit_outside_gaps;
+  mutable std::atomic_uint m_hit_outside_gaps{0};
 
-  std::string m_mcHeader ; ///< Location of MC Header
-  std::string m_muonHits ; ///< Location of muon hits
+  void bookHistograms();
 };
-#endif // MuonHitChecker_H
diff --git a/Sim/Gauss/CMakeLists.txt b/Sim/Gauss/CMakeLists.txt
index 1a3d21e74fa5e701f76bb733c22e0719d4fce540..6072d921c4dd3c5482bf6e9c5b312032938e0583 100644
--- a/Sim/Gauss/CMakeLists.txt
+++ b/Sim/Gauss/CMakeLists.txt
@@ -3,36 +3,34 @@
 ################################################################################
 gaudi_subdir(Gauss v53r2)
 
-find_package(HepMC)
-
-gaudi_depends_on_subdirs(Det/DDDB
-                         Det/DetSys
-                         Event/EventPacker
-                         Gaudi
-                         GaudiConf
-                         GaudiKernel
-                         Kernel/KernelSys
-                         Sim/SimComponents
-                         Sim/GaussAlgs
-                         Gen/LbPGuns
-                         Gen/LbMIB
-                         Gen/LbPythia
-                         Gen/LbPythia8
-                         Gen/LbHijing
-                         Gen/LbCRMC
-                         Sim/GaussAlgs
-                         Sim/GaussKine
-                         Sim/GaussRICH
-                         Sim/GaussRedecay
-                         Sim/GaussCherenkov
-                         Sim/GaussCalo
-                         Sim/GaussTracker
-                         Muon/MuonMoniSim)
+#gaudi_depends_on_subdirs(Det/DDDB
+                         #Det/DetSys
+                         #Event/EventPacker
+                         #Gaudi
+                         #GaudiConf
+                         #GaudiKernel
+                         #Kernel/KernelSys
+                         #Sim/SimComponents
+                         #Sim/GaussAlgs
+                         #Gen/LbPGuns
+                         #Gen/LbMIB
+                         #Gen/LbPythia
+                         #Gen/LbPythia8
+                         #Gen/LbHijing
+                         #Gen/LbCRMC
+                         #Sim/GaussAlgs
+                         #Sim/GaussKine
+                         #Sim/GaussRICH
+                         #Sim/GaussRedecay
+                         #Sim/GaussCherenkov
+                         #Sim/GaussCalo
+                         #Sim/GaussTracker
+                         #Muon/MuonMoniSim)
 
 gaudi_install_python_modules()
-gaudi_install_scripts()
+#gaudi_install_scripts()
 
-gaudi_env(SET AlwaysKillLeadingHadron 1
-          SET GAUSSOPTS \${GAUSSROOT}/options)
+#gaudi_env(SET AlwaysKillLeadingHadron 1
+          #SET GAUSSOPTS \${GAUSSROOT}/options)
 
-gaudi_add_test(QMTest QMTEST)
+#gaudi_add_test(QMTest QMTEST)
diff --git a/Sim/Gauss/python/Gauss/Configuration.py b/Sim/Gauss/python/Gauss/Configuration.py
index 724e5e75503cbf0c326cd06a7e571dddf7edf113..bacd09f1e69873977264e4bbd118240d815ed119 100755
--- a/Sim/Gauss/python/Gauss/Configuration.py
+++ b/Sim/Gauss/python/Gauss/Configuration.py
@@ -3,268 +3,82 @@ High level configuration tools for Gauss
 Beampipe configuration added.
 """
 __version__ = "$Id: Configuration.py,v 1.30 2010/05/09 18:14:28 gcorti Exp $"
-__author__  = "Gloria Corti <Gloria.Corti@cern.ch>"
+__author__ = "Gloria Corti <Gloria.Corti@cern.ch>"
 
-from Gaudi.Configuration import *
-import GaudiKernel.ProcessJobOptions
-from GaudiKernel import SystemOfUnits
+from Gaudi.Configuration import log, GaudiSequencer, FileCatalog
+from Gaudi.Configuration import ApplicationMgr
 from Configurables import LHCbConfigurableUser, LHCbApp, SimConf
+from Configurables import Gaussino
+from GaudiKernel import SystemOfUnits
 
 
-# CRJ - Its un-neccessary to import everythting by default. Better to
-#       import as and when you need it ...
-from Configurables import ( EventClockSvc, FakeEventTime )
-from Configurables import ( GenInit, Generation, MinimumBias, Inclusive,
-#from Configurables import ( GenInit, Generation,
-# Double imports
-                            SignalPlain, SignalRepeatedHadronization,
-                            SignalForcedFragmentation, StandAloneDecayTool,
-                            Special,
-                            PythiaProduction, HijingProduction,
-                            CRMCProduction,
-# Not used
-                            CollidingBeams, FixedTarget,
-                            BeamSpotSmearVertex, FlatZSmearVertex,
-                            EvtGenDecay )
-from Configurables import ( SimInit, GaussGeo, GiGaGeo, GiGaInputStream, GiGa,
-                            GiGaDataStoreAlgorithm,
-                            GiGaPhysListModular, GiGaRunActionSequence,
-                            TrCutsRunAction, GiGaRunActionCommand,
-                            GiGaEventActionSequence, GiGaMagFieldGlobal,
-                            GiGaTrackActionSequence, GaussPostTrackAction,
-                            GiGaStepActionSequence, SimulationSvc,
-                            GiGaFieldMgr, GiGaRunManager, GiGaSetSimAttributes,
-                            GiGaPhysConstructorOp, GiGaPhysConstructorHpd,
-                            SpdPrsSensDet, EcalSensDet, HcalSensDet,
-                            GaussSensPlaneDet )
-from Configurables import ( GenerationToSimulation, GiGaFlushAlgorithm,
-                            GiGaCheckEventStatus, SimulationToMCTruth,
-                            GiGaGetEventAlg, GiGaGetHitsAlg,
-                            GetTrackerHitsAlg, GetCaloHitsAlg,
-                            GetMCRichHitsAlg, GetMCRichOpticalPhotonsAlg,
-                            GetMCRichSegmentsAlg, #GetMCRichTracksAlg,
-                            Rich__MC__MCPartToMCRichTrackAlg,
-                            Rich__MC__MCRichHitToMCRichOpPhotAlg)
-from Configurables import ( GenMonitorAlg, MuonHitChecker, MCTruthMonitor,
-                            VeloGaussMoni, MCHitMonitor, MCCaloMonitor,
-                            DumpHepMC )
-from Configurables import ( PackMCParticle, PackMCVertex,
-                            UnpackMCParticle, UnpackMCVertex,
-                            CompareMCParticle, CompareMCVertex )
-
-# Various options for the RICH
-from Configurables import (GaussRICHConf, GaussCherenkovConf)
-
-# All GaussRedecay includes
-from Configurables import ( GaussRedecay, GaussRedecayCopyToService,
-                            GaussRedecayRetrieveFromService,
-                            GaussRedecayPrintMCParticles,
-                            GaussRedecayCtrFilter,
-                            GaussRedecaySorter,
-                            GaussHepMCSplitter,
-                            GaussRedecayMergeAndClean)
-
-from DetCond.Configuration import CondDB
-
-## @class Gauss
-#  Configurable for Gauss application
-#  @author Gloria Corti <Gloria.Corti@cern.ch>
-#  @date   2009-07-13
-
 class Gauss(LHCbConfigurableUser):
 
-    __knownDetectors__ = [
-        'velo', 'puveto', 'vp',
-        'tt' , 'ut',
-        'it' , 'sl',
-        'ot' , 'ft', 'ft-noshield',
-        'rich',  'rich1', 'rich2', 'torch' ,
-        'calo',  'spd', 'prs', 'ecal', 'hcal' ,
-        'muon' ,
-        'magnet',
-        'rich1pmt', 'rich2pmt',
-        'hc'
-#        'bcm', 'bls'
-        ]
-
-    ## Possible used Configurables
-    __used_configurables__ = [ LHCbApp, SimConf,
-                               (GaussRICHConf,None),
-                               (GaussCherenkovConf,None)
-                               ]
+    # Possible used Configurables
+    __used_configurables__ = [LHCbApp, SimConf, Gaussino,
+                              # (GaussRICHConf,None),
+                              # (GaussCherenkovConf,None)
+                              ]
 
-    ## Map to contain PDG ids for beam particles
-    __ion_pdg_id__ = { 'Pb': 1000822080 , 'Ar': 1000180400 , 'p': 2212 , 'Ne': 1000100200 , 'He': 1000020040 , 'Kr': 1000360840 ,
-                       'Xe': 1000541320 }
-
-    ## Steering options
+    # Steering options
     __slots__ = {
-        "Histograms"        : "DEFAULT"
-        ,"DatasetName"       : "Gauss"
-        ,"DataType"          : ""
-        # Simple lists of sub detectors
-        ,"DetectorGeo"       : {"Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet'] }
-        ,"DetectorSim"       : {"Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet'] }
-        ,"DetectorMoni"      : {"Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon'] }
-        ,"SpilloverPaths"    : []
-        ,"PhysicsList"       : {"Em":'NoCuts', "Hadron":'FTFP_BERT', "GeneralPhys":True, "LHCbPhys":True, "Other": '' }
-        ,"DeltaRays"         : True
-        ,"RICHRandomHits"    : False
-        ,"Phases"            : ["Generator","Simulation"] # The Gauss phases to include in the SIM file
-        ,"BeamMomentum"      : 3.5*SystemOfUnits.TeV
-        ,"BeamHCrossingAngle" : -0.520*SystemOfUnits.mrad
-        ,"BeamVCrossingAngle" : 0.0
-        ,"BeamEmittance"     : 0.0037*SystemOfUnits.mm
-        ,"BeamBetaStar"      : 3.1*SystemOfUnits.m
-        ,"BeamLineAngles"    : [ -0.075*SystemOfUnits.mrad,
-                                  0.035*SystemOfUnits.mrad ]
-        ,"InteractionPosition" : [  0.459*SystemOfUnits.mm ,
-                                   -0.015*SystemOfUnits.mm ,
-                                    0.5*SystemOfUnits.mm ]
-        ,"BunchRMS"          : 82.03*SystemOfUnits.mm
-        ,"Luminosity"        : 0.247*(10**30)/(SystemOfUnits.cm2*SystemOfUnits.s)
-        ,"TotalCrossSection" : 91.1*SystemOfUnits.millibarn
-        ,"OutputType"        : 'SIM'
-        ,"Production"        : 'PHYS'
-        ,"EnablePack"        : True
-        ,"DataPackingChecks" : True
-        ,"WriteFSR"          : True
-        ,"MergeGenFSR"       : False
-        ,"Debug"             : False
-        ,"BeamPipe" : "BeamPipeOn" # _beamPipeSwitch = 1
-        ,"ReplaceWithGDML"   : [ { "volsToReplace" : [], "gdmlFile" : "", 'volsToInstrument' : {} } ]
-        #,"BeamPipe" : "BeamPipeOff"  # _beamPipeSwitch = 0
-        #,"BeamPipe" : "BeamPipeInDet"  # _beamPipeSwitch = -1
-        ,"RandomGenerator"   : 'Ranlux'
-        ## Add properties for fixed target and heavy ion simulation
-        ## energy of the beam 2 (beam 1 is taken from the BeamMomentum property
-        ## if this energy is 0, or if BeamMomentum is 0, it is fixed target simulation
-        , "B2Momentum" : 3.5*SystemOfUnits.TeV
-        ## type of particle in the beam or in the fixed target
-        , "B1Particle" : 'p'
-        , "B2Particle" : 'p'
-        , "UseGaussGeo" : True
-        , "Redecay" : {"N": 100, 'active': False, 'rd_mode': 1}
-        , "CurrentRICHSimRunOption" : 'GTB'
-        , "UpgradeRICHSimRunOption"  : 'GTB'
-        , "SplitSim" : False
-        , "PostSimFilters"  : []
-      }
+        # The Gauss phases to include in the SIM file
+        "Histograms": "DEFAULT",
+        "DatasetName": "Gauss",
+        "DataType": "", "SpilloverPaths": [],
+        "OutputType": 'SIM', "EnablePack": True,
+        "DataPackingChecks": True,
+        "WriteFSR": False,
+        "MergeGenFSR": False,
+        "Debug": False,
+        "ForceRandomEngine": 'NONE',
+        "Phases": ["Generator", "Simulation"],
+        "BeamMomentum": 3.5 * SystemOfUnits.TeV,  # NOQA
+        "BeamHCrossingAngle": -0.520 * SystemOfUnits.mrad,  # NOQA
+        "BeamVCrossingAngle": 0.0,  # NOQA
+        "BeamEmittance": 0.0037 * SystemOfUnits.mm,  # NOQA
+        "BeamBetaStar": 3.1 * SystemOfUnits.m,  # NOQA
+        "BeamLineAngles": [-0.075 * SystemOfUnits.mrad, 0.035 * SystemOfUnits.mrad],  # NOQA
+        "InteractionPosition" : [0.459 * SystemOfUnits.mm, -0.015 * SystemOfUnits.mm, 0.5 * SystemOfUnits.mm],  # NOQA
+        "BunchRMS": 82.03 * SystemOfUnits.mm,  # NOQA
+        "Luminosity": 0.247 * (10 ** 30) / (SystemOfUnits.cm2 * SystemOfUnits.s),  # NOQA
+        "TotalCrossSection": 91.1 * SystemOfUnits.millibarn,  # NOQA
+        "B2Momentum": 3.5 * SystemOfUnits.TeV,  # NOQA
+        "B1Particle": 'p',  # NOQA
+        "B2Particle": 'p',  # NOQA
+        "EvtMax": -1,  # NOQA
+        "EnableHive": False,  # NOQA
+        "ThreadPoolSize": 2,  # NOQA
+        "EventSlots" : 2,  # NOQA
+        "ConvertEDM" : False,  # NOQA
+        }
 
-    _detectorsDefaults = {"Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet'] }
     _propertyDocDct = {
-        'Histograms'     : """ Type of histograms: ['NONE','DEFAULT'] """
-       ,'DatasetName'    : """ String used to build output file names """
-       ,"DataType"       : """ Must specify 'Upgrade' for upgrade simulations, otherwise not used """
-       ,"DetectorGeo"    : """ Dictionary specifying the detectors to take into account in Geometry """
-       ,"DetectorSim"    : """ Dictionary specifying the detectors to simulated (should be in geometry): """
-       ,"DetectorMoni"   : """ Dictionary specifying the detectors to monitor (should be simulated) :"""
-       ,'SpilloverPaths' : """ Spillover paths to fill: [] means no spillover, otherwise put ['Next', 'Prev', 'PrevPrev'] """
-       ,'PhysicsList'    : """ Name of physics modules to be passed 'Em':['Std','Opt1,'Opt2','Opt3','NoCuts','LHCb', 'LHCbNoCuts', 'LHCbOldForE', 'LHCbNoCutsOldForE', 'LHCbTest', 'LHCbTestNoCut' ], 'GeneralPhys':[True,False], 'Hadron':['QGSP_BERT','QGSP_BERT_HP','QGSP_FTFP_BERT','FTFP_BERT','FTFP_BERT_HP'], 'LHCbPhys': [True,False], 'Other': [''] """
-       ,"DeltaRays"      : """ Simulation of delta rays enabled (default True) """
-       ,'Phases'         : """ List of phases to run (Generator, Simulation, GenToMCTree) """
-       ,'OutputType'     : """ Output: [ 'NONE', 'GEN', 'XGEN', 'RGEN', 'SIM', 'XSIM' ] (default 'SIM') """
-       ,'Production'     : """ Generation type : ['PHYS', 'PGUN', 'MIB' (default 'PHYS')"""
-       ,'EnablePack'     : """ Flag to turn on or off the packing of the SIM data """
-       ,'DataPackingChecks' : """ Flag to turn on or off the running of some test algorithms to check the quality of the data packing """
-       ,"WriteFSR"       : """Add file summary record, default True"""
-       ,"MergeGenFSR"    : """Flags whether to merge the generator level FSRs"""
-       ,"BeamPipe"       : """Switch for beampipe definition; BeamPipeOn: On everywhere, BeamPipeOff: Off everywhere, BeamPipeInDet: Only in named detectors """
-       ,"ReplaceWithGDML": """Replace a list of specified volumes with GDML description from file provided """
-       ,"RandomGenerator": """Name of randon number generator engine: Ranlux or MTwist"""
-       ,"UseGaussGeo"    : """Use GaussGeo (True: default) or GiGaGeo (False) for geometry conversion"""
-       ,"Redecay"        : """ Dict with redecay settings, default: {'N': 100, 'active': False, 'rd_mode': 1}."""
-       ,"CurrentRICHSimRunOption" : """ GaussRICH run options: ['Formula1', 'GTB', 'SUV','HGV', 'clunker', 'FareFiasco'] (default 'GTB') """
-       ,"UpgradeRICHSimRunOption" : """ GaussCherenkov run options: ['Formula1', 'GTB', 'SUV','HGV', 'clunker' , 'FareFiasco'] (default 'GTB') """
-       , "SplitSim"      : """ Split the simulation phase for gamma-conversion. (default: False)"""
-       ,"PostSimFilters" : """ List of filters that are executed after Geant has run (default: none)"""
+        'Histograms'     : """ Type of histograms: ['NONE','DEFAULT'] """  # NOQA
+       , 'DatasetName'    : """ String used to build output file names """  # NOQA
+       , 'Phases'         : """ List of phases to run (Generator, Simulation, GenToMCTree) """  # NOQA
+       , "DataType"       : """ Must specify 'Upgrade' for upgrade simulations, otherwise not used """  # NOQA
+       , 'SpilloverPaths' : """ Spillover paths to fill: [] means no spillover, otherwise put ['Next', 'Prev', 'PrevPrev'] """  # NOQA
+       , "DeltaRays"      : """ Simulation of delta rays enabled (default True) """  # NOQA
+       , 'OutputType'     : """ Output: [ 'NONE', 'GEN', 'XGEN', 'RGEN', 'SIM', 'XSIM' ] (default 'SIM') """  # NOQA
+       , 'Production'     : """ Generation type : ['PHYS', 'PGUN', 'MIB' (default 'PHYS')"""  # NOQA
+       , 'EnablePack'     : """ Flag to turn on or off the packing of the SIM data """  # NOQA
+       , 'DataPackingChecks' : """ Flag to turn on or off the running of some test algorithms to check the quality of the data packing """  # NOQA
+       , "ForceRandomEngine"   : """Force the random number generator for all AlgSeeders"""  # NOQA
        }
-    KnownHistOptions     = ['NONE','DEFAULT']
-    TrackingSystem       = ['VELO','TT','IT','OT']
-    PIDSystem            = ['RICH','CALO','MUON']
-
-    Run1DataTypes = [ "2009", "2010", "2011", "2012", "2013" ]
-    Run2DataTypes = [ "2015", "2016", "2017", "2018" ]
-
-    _beamPipeStates = ['beampipeon', 'beampipeoff', 'beampipeindet']
-
-    KnownPostSimFilters    = [ "ConversionFilter" ]
-
-    _incompatibleDetectors = {
-        "Velo"       : [ "Velo", "VP" ],
-        "VeloPuVeto" : [ "PuVeto", "VP" ],
-        "TT"         : [ "TT", "UT" ],
-        "Muon"       : [ "Muon", "MuonNoM1" ],
-        "MuonTorch"  : [ "Muon", "Torch" ]
-        }
-
-    _beamPipeElements = {
-        #"upstreamregion" : [
-        #"/dd/Structure/LHCb/UpstreamRegion/PipeUpstream" ,
-        #"/dd/Structure/LHCb/UpstreamRegion/MBXWHUp" ],
-        #"beforemagnetregion" : [
-        #    "/dd/Structure/LHCb/BeforeMagnetRegion/PipeJunctionBeforeVelo",
-        #    "/dd/Structure/LHCb/BeforeMagnetRegion/BeforeVelo/PipeBeforeVelo",
-        #    "/dd/Structure/LHCb/BeforeMagnetRegion/BeforeVelo/PipeSupportBeforeVelo" ],
-                         "velo" : [
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownStreamWakeFieldCone",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamWakeFieldCone",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank" ],
-                         "rich1" : [
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1BeforeSubM",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1SubMaster",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1AfterSubM",
-            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/Rich1BeamPipe" ],
-                         "tt" : [
-            "/dd/Structure/LHCb/BeforeMagnetRegion/TT/PipeInTT" ],
-                         "ut" : [
-            "/dd/Structure/LHCb/BeforeMagnetRegion/UT/PipeInUT" ],
-                         "magnet" : [
-            "/dd/Structure/LHCb/MagnetRegion/PipeInMagnet",
-            "/dd/Structure/LHCb/MagnetRegion/PipeSupportsInMagnet" ],
-                         "AfterMagnetRegion" : [
-            "/dd/Structure/LHCb/AfterMagnetRegion/PipeAfterT",
-            "/dd/Structure/LHCb/AfterMagnetRegion/PipeSupportsAfterMagnet" ],
-                         "t" : [
-            "/dd/Structure/LHCb/AfterMagnetRegion/T/PipeInT" ],
-                         "rich2" : [
-            "/dd/Structure/LHCb/AfterMagnetRegion/Rich2/Rich2BeamPipe" ],
-                         "downstreamregion" : [
-            "/dd/Structure/LHCb/DownstreamRegion/PipeDownstream",
-            "/dd/Structure/LHCb/DownstreamRegion/PipeSupportsDownstream",
-            "/dd/Structure/LHCb/DownstreamRegion/PipeBakeoutDownstream" ]
-                         #"aftermuon" : [
-                         #"/dd/Structure/LHCb/DownstreamRegion/AfterMuon/PipeAfterMuon",
-            #"/dd/Structure/LHCb/DownstreamRegion/AfterMuon/MBXWSDown" ]
-        }
+    KnownHistOptions = ['NONE', 'DEFAULT']
+    TrackingSystem = ['VELO', 'TT', 'IT', 'OT']
+    PIDSystem = ['RICH', 'CALO', 'MUON']
 
-    # List of geometry objects which will be converted, it's content is used in
-    # GaussGeo or in GiGaInputStream if GiGaGeo is used for conversion
-    _listOfGeoObjects_ = []
+    Run1DataTypes = ["2009", "2010", "2011", "2012", "2013"]
+    Run2DataTypes = ["2015", "2016", "2017", "2018"]
 
-#"""
-#Helper
-#HELPER
-#
-#  ><<     ><<             ><<
-#  ><<     ><<             ><<
-#  ><<     ><<    ><<      ><< >< ><<      ><<     >< ><<<
-#  ><<<<<< ><<  ><   ><<   ><< ><  ><<   ><   ><<   ><<
-#  ><<     ><< ><<<<< ><<  ><< ><   ><< ><<<<< ><<  ><<
-#  ><<     ><< ><          ><< ><< ><<  ><          ><<
-#  ><<     ><<   ><<<<     ><< ><<        ><<<<     ><<<
-#                              ><<
-#
-#"""
-    ##
-    ##
-    def slotName(self,slot) :
+    def slotName(self, slot):
         name = slot
-        if slot == '' : name = "Main"
+        if slot == '':
+            name = "Main"
         return name
 
-
     def isGaussMP(self):
         import argparse
         parser = argparse.ArgumentParser(description='Hello')
@@ -273,4245 +87,167 @@ class Gauss(LHCbConfigurableUser):
         args = parser.parse_known_args()
         return args[0].ncpus != 0
 
-    ##
-    ## Helper functions for spill-over
-    def slot_( self, slot ):
+    def slot_(self, slot):
         if slot != '':
             return slot + '/'
         return slot
 
-    ##
-    def setTrackersHitsProperties( self, alg , det , slot , dd ):
-        alg.MCHitsLocation = '/Event/' + self.slot_(slot) + 'MC/' + det + '/Hits'
-        if det == 'PuVeto':
-            det = 'VeloPu'
-        alg.CollectionName = det + 'SDet/Hits'
-        alg.Detectors = ['/dd/Structure/LHCb/'+dd]
-
-    ##
-    def evtMax(self):
-        return LHCbApp().evtMax()
-
-    ##
     def eventType(self):
         from Configurables import Generation
         evtType = ''
         if Generation("Generation").isPropertySet("EventType"):
-            evtType = str( Generation("Generation").EventType )
+            evtType = str(Generation("Generation").EventType)
         return evtType
 
-    def setLHCbAppDetectors(self):
-        from Configurables import LHCbApp
-        # If detectors set in LHCbApp then use those
-        if hasattr(LHCbApp(),"Detectors"):
-            if not LHCbApp().Detectors:
-                LHCbApp().Detectors = self.getProp("DetectorGeo")["Detectors"]
-            else:
-                log.warning("Value of 'LHCbApp().Detectors' already set, using that value: %s" %(LHCbApp().Detectors))
-        return
-
-#"""
-##########################################################################
-##########################################################################
-##########################################################################
-##########################################################################
-##########################################################################
-#"""
-
-
-
-# ><< ><<
-# ><    ><<                                                ><
-# ><     ><<    ><<        ><<     ><<< ><< ><<  >< ><<       >< ><<      ><<
-# ><<< ><     ><   ><<   ><<  ><<   ><<  ><  ><< ><  ><<  ><< ><  ><<   ><   ><<
-# ><     ><< ><<<<< ><< ><<   ><<   ><<  ><  ><< ><   ><< ><< ><   ><< ><<<<< ><<
-# ><      >< ><         ><<   ><<   ><<  ><  ><< ><< ><<  ><< ><< ><<  ><
-# ><<<< ><<    ><<<<      ><< ><<< ><<<  ><  ><< ><<      ><< ><<        ><<<<
-#                                                ><<          ><<
-
-    def validateBeamPipeSwitch ( self, bpString ):
-        import string
-        bpLower = self.getProp("BeamPipe").lower()
-        if bpLower not in self._beamPipeStates:
-            raise RuntimeError("ERROR: BeamPipe configuration '%s' not recognised!" %bpString)
-
-    def removeBeamPipeElements( self, det ):
-        det = det.lower()
-        # Remove beampipe elements in <det> - will be included automatically
-        if det in self._beamPipeElements.keys():
-            for element in self._beamPipeElements[det]:
-                # remove all instances of the element
-                while element in self._listOfGeoObjects_:
-                    self._listOfGeoObjects_.remove(element)
-
-    def removeAllBeamPipeElements( self ):
-        # Remove all beampipe elements
-        for det in self._beamPipeElements.keys():
-            for element in self._beamPipeElements[det]:
-                # remove all instances of the element
-                while element in self._listOfGeoObjects_:
-                    self._listOfGeoObjects_.remove(element)
-
-    def defineBeamPipeGeo ( self, basePieces, detPieces ):
-        # Add all BeamPipe Elements in the BeamPipeElements dictionary
-
-        # Here commences a hack to deal with daft DDDB structure
-        ignoreList = ['ut', 'tt']
-        # decide if TT or UT in dets to simulate
-        ttDetectorList = [det for det in ['UT', 'TT'] if det in self.getProp('DetectorGeo')['Detectors']]
-        # lower strings
-        if ttDetectorList:
-            # lower everything in ttDetectorList
-            ttDetectorList = [det.lower() for det in ttDetectorList]
-            # get the elements to ignore
-            ignoreList = [det for det in ignoreList if det not in ttDetectorList]
-
-        for region in self._beamPipeElements.keys():
-            if region in ignoreList:
-                continue
-            for element in self._beamPipeElements[region]:
-                self._listOfGeoObjects_.append(element)
-
-        # Finally add in the TT or UT beampipe if we're not defining the detectors but want the BP anyway depending on DataType
-        # Nasty and unclean - change the DDDB s.t. it makes sense please!
-        if (
-            ("UT" not in self.getProp("DetectorGeo")["Detectors"])
-            and
-            ("TT" not in self.getProp("DetectorGeo")["Detectors"])
-            ):
-            if self.getProp("DataType") not in ["Upgrade"]:
-                for element in self._beamPipeElements["tt"]:
-                    self._listOfGeoObjects_.append(element)
-            else:
-                for element in self._beamPipeElements["ut"]:
-                    self._listOfGeoObjects_.append(element)
-
+    def propagateSimConf(self):
+        # Propagate properties to SimConf
+        SimConf().setProp("Writer", "GaussTape")
+        self.setOtherProps(
+            SimConf(), [
+                "SpilloverPaths", "EnablePack", "Phases", "DataType"])
+        # Empty the list of detectors, it is later populated when configuring
+        # the subdetectors
+        SimConf().Detectors = []
+        # if we have post-sim filters, we only want to write if the filter is
+        # passed
+        # if self.getProp("PostSimFilters"):
+        # OutputStream("GaussTape").RequireAlgs.append("PostSimFilterSeq")
 
-    def defineGDMLGeo ( self, geoCnvSvc, gdmlDict ):
+        # Don't want SIM data unpacking enabled in DoD service
+        SimConf().EnableUnpack = False
 
-        # Define the GDML reader tool and add it to the sequence
-        from Configurables import GDMLReader
-        import os
-        gdmlFile = gdmlDict["gdmlFile"]
-        instrumentation = gdmlDict['volsToInstrument'] if 'volsToInstrument' in gdmlDict else {}
-        parsed_instr = {}
+        class dummy:
+            def __init__(self):
+                self.Members = []
 
-        if gdmlFile:
-            gdmlToolName = os.path.splitext(os.path.basename(gdmlFile))[0]
-            gdmlTool = GDMLReader( gdmlToolName,
-                                   FileName = gdmlFile )
-            reader = geoCnvSvc.addTool(gdmlTool, gdmlToolName)
-            import Configurables
-            for vol, instr in instrumentation.items():
-                tool, name, kwargs = instr
-                reader.addTool( getattr(Configurables, tool)(name, **kwargs), name=name )
-                parsed_instr[vol] = tool + "/" + name
-            reader.SensitiveDetectors = parsed_instr
-            geoCnvSvc.GdmlReaders.append(gdmlToolName)
+        packing = dummy()
+        # Need this dummy sequence to later extract all the algorithm that
+        # need to be given to the scheduler.
+        if Gaussino().getProp('ConvertEDM') or "Simulation" in Gauss().getProp("Phases"):
+            for so in self.defineCrossingList():
+                SimConf().PackingSequencers[so] = packing
 
-            # Remove the corresponding geometry from the Geo.InputStreams
-            for item in [g for g in gdmlDict["volsToReplace"] if g != '']:
-                if item in self._listOfGeoObjects_:
-                    self._listOfGeoObjects_.remove(item)
-                else:
-                    raise RuntimeError("ERROR: Volume not in list of existing volumes, '%s'" %item)
-        else:
-           raise RuntimeError("ERROR: Invalid GDML file provided, '%s'" %gdmlFile)
+        from Gaudi.Configuration import appendPostConfigAction
 
+        def runit():
+            for a in packing.Members:
+                ApplicationMgr().TopAlg += [a]
 
+        appendPostConfigAction(runit)
+        SimConf().SaveHepMC = False
 
-#"""
-#><<         ><<             ><<               ><<<<<     ><<<<<     ><<<<<     ><< ><<
-# ><<       ><<              ><<               ><<   ><<  ><<   ><<  ><<   ><<  ><    ><<
-#  ><<     ><<      ><<      ><<    ><<        ><<    ><< ><<    ><< ><<    ><< ><     ><<
-#   ><<   ><<     ><   ><<   ><<  ><<  ><<     ><<    ><< ><<    ><< ><<    ><< ><<< ><
-#    ><< ><<     ><<<<< ><<  ><< ><<    ><<    ><<    ><< ><<    ><< ><<    ><< ><     ><<
-#     ><<<<      ><          ><<  ><<  ><<     ><<   ><<  ><<   ><<  ><<   ><<  ><      ><
-#      ><<         ><<<<    ><<<    ><<        ><<<<<     ><<<<<     ><<<<<     ><<<< ><<
-#"""
+    def defineCrossingList(self):
+        crossingList = ['']
+        spillOverList = self.getProp("SpilloverPaths")
+        while '' in spillOverList:
+            spillOverList.remove('')
+        crossingList += spillOverList
+        return crossingList
 
-    def checkVeloDDDB( self ):
+    def defineOutput(self, SpillOverSlots):
         """
-        Check if the Velo geometry is compatible with the chosen tags
+        Set up output stream according to phase processed,
+        the spill-over slots and the type of output
         """
-        # set validity limits for  Velo geometry
-        # first postMC09 Velo geometry
-        GTagLimit1 = "head-20091120"
-        GTagLimit1 = GTagLimit1.split('-')[1].strip()
-        VeloLTagLimit1 = "velo-20091116"
-        VeloLTagLimit1 = VeloLTagLimit1.split('-')[1].strip()
-        # Thomas L. Velo geometry
-        GTagLimit2 = "head-20100119"
-        GTagLimit2 = GTagLimit2.split('-')[1].strip()
-        VeloLTagLimit2 = "velo-20100114"
-        VeloLTagLimit2 = VeloLTagLimit2.split('-')[1].strip()
-
-        # DDDB global tag used
-        DDDBDate = LHCbApp().DDDBtag
-        DDDBDate = DDDBDate.split('-')
-
-        # Check if DDDB tag has a regular format (instead of e.g. a user git branch)
-        if len(DDDBDate) > 1 :
-          DDDBDate = DDDBDate[1].strip()
-          if DDDBDate.isdigit() :
-
-            # check if/which local tag is used for Velo
-            cdb = CondDB()
-            cdbVeloDate = 0
-            for p in cdb.LocalTags:
-                if p == "DDDB":
-                    taglist = list(cdb.LocalTags[p])
-                    for ltag in taglist:
-                        if ltag.find("velo")!=-1 :
-                            cdbVeloDate = ltag.split('-')[1].strip()
-
-            # Put this here rather than as an argument
-            VeloPostMC09 = 0
-            # check if the selected tags require one of the postMC09 Velo geometries
-            if (DDDBDate >= GTagLimit1) or (cdbVeloDate >= VeloLTagLimit1):
-                VeloPostMC09 = 1
-            if (DDDBDate >= GTagLimit2) or (cdbVeloDate >= VeloLTagLimit2):
-                VeloPostMC09 = 2
-
-            return VeloPostMC09
-
-        log.warning("DDDB tag not parsable as date. Using post-MC09 velo geometry : %s" %(DDDBDate))
-        return 2
-
-
 
-    ##
-    ##
-
-
-#"""
-# ><<         ><< ><<<<<<<< ><<           ><<<<
-#  ><<       ><<  ><<       ><<         ><<    ><<
-#   ><<     ><<   ><<       ><<       ><<        ><<
-#    ><<   ><<    ><<<<<<   ><<       ><<        ><<
-#     ><< ><<     ><<       ><<       ><<        ><<
-#      ><<<<      ><<       ><<         ><<     ><<
-#       ><<       ><<<<<<<< ><<<<<<<<     ><<<<
-#"""
-
-
-    ##
-    ##
-    def veloMisAlignGeometry( self, VeloPostMC09 ):
-
-        print "veloMisAlignGeometry: %s" %(VeloPostMC09)
-
-        """
-        File containing the list of detector element to explicitely set
-        to have misalignement in the VELO.
-        """
-        # remove Automatically included detector elements
-        self.removeBeamPipeElements( "velo" )
+        #
+        knownOptions = ['NONE', 'GEN', 'XGEN', 'RGEN', 'SIM', 'XSIM']
+        output = self.getProp("OutputType").upper()
+        if output == 'NONE':
+            log.warning("No event data output produced")
+            return
 
+        simWriter = SimConf().writer()
 
-        if "/dd/Structure/LHCb/BeforeMagnetRegion/Velo" in self._listOfGeoObjects_:
-            self._listOfGeoObjects_.remove("/dd/Structure/LHCb/BeforeMagnetRegion/Velo")
+        # define default file extensions depending on the phase that has been
+        # run
+        fileDefaultExtension = ".gen"
+        fileAllowedExtension = [fileDefaultExtension]
+        if "GenToMCTree" in self.getProp("Phases"):
+            fileDefaultExtension = ".xgen"
+            fileAllowedExtension = [fileDefaultExtension, ".rgen"]
+        elif "Simulation" in self.getProp("Phases"):
+            fileDefaultExtension = ".sim"
+            fileAllowedExtension = [fileDefaultExtension, ".xsim"]
 
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModulePU00")
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModulePU02")
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ModulePU01")
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ModulePU03")
+        # choose the file extension from the one selected compatibly with the
+        # phase run
+        if output not in knownOptions:
+            print "WARNING: OutputType not supported." \
+                  "Use default for chosen phases : %s" % (fileDefaultExtension)
+        fileExtension = "." + output.lower()
+        if fileExtension not in fileAllowedExtension:
+            fileExtension = fileDefaultExtension
+            print "WARNING: OutputType not supported" \
+                  " for this phase. Use default : %s" % (fileExtension)
 
-        txt = "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModuleXX"
-        import math
-        for i in range(42):
-            nr = str(i)
-            if len(nr) == 1 : nr = '0'+str(i)
-            temp1 = txt.replace('XX',nr)
-            if math.modf(float(nr)/2.)[0] > 0.1 :  temp1 = temp1.replace('Left','Right')
-            self._listOfGeoObjects_.append(temp1)
+        # set saving or not of HepMC depending on chosen file extension
+        if SimConf().isPropertySet("SaveHepMC"):
+            print "WARNING: SimConf().SaveHepMC will" \
+                  " be ignored. Value set by Gauss()"
+        saveHepMC = False
+        if fileExtension in ['.gen', '.xgen', '.xsim']:
+            saveHepMC = True
+        SimConf().setProp("SaveHepMC", saveHepMC)
 
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownStreamWakeFieldCone")
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamWakeFieldCone")
-        if (VeloPostMC09==1):
-            # description postMC09 of Velo (head-20091120), problem with Velo Tank simulation
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpstreamPipeSections")
-        elif (VeloPostMC09==2):
-            # Thomas L. newer description postMC09 of Velo
-            # --- Velo Right
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/RFBoxRight")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/DetSupportRight")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ConstSysRight")
-            # --- Velo Left
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/RFBoxLeft")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/DetSupportLeft")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ConstSysLeft")
-            # --- Velo
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpstreamPipeSections")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank")
+        outputFile = ""
+        from GaudiConf import IOHelper
+        if simWriter.isPropertySet("Output"):
+            outputFile = IOHelper().undressFile(simWriter.getProp("Output"))
         else:
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamVacTank")
-            self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownStreamVacTank")
-
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/RFFoilRight")
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/RFFoilLeft")
-    ##
-    ##
-
-
-    def defineVeloGeo( self , basePieces , detPieces ):
-        # Alter in place BasePieces
-        # check if the new velo geometry is required with the chosen DDDB tags
-
-        VeloP = self.checkVeloDDDB()
-        if (VeloP==1 or VeloP==2):
-            basePieces['BeforeMagnetRegion']=[]
-
-        # Also sort out mis-alignment
-        VeloP = self.checkVeloDDDB()
-        # No need to check, this is the case if this is called.
-        # No need to misalign if only PuVeto exits - check me PSZ.
-        if "Velo" in self.getProp('DetectorGeo')['Detectors']:
-            self.veloMisAlignGeometry(VeloP) # To misalign VELO
-
-
-
-
-
-    def configureVeloSim( self, slot, detHits ):
-        region = "BeforeMagnetRegion"
-        det = "Velo"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-
-
-    def configureVeloMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.VeloHits = 'MC/Velo/Hits'
-
-        ## Set the VeloMonitor
-        detMoniSeq.Members += [ VeloGaussMoni( "VeloGaussMoni" + slot ) ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            from Configurables import DataPacking__Unpack_LHCb__MCVeloHitPacker_
-            upVelo = DataPacking__Unpack_LHCb__MCVeloHitPacker_("UnpackVeloHits"+slot,
-                                                                OutputName = "MC/Velo/HitsTest" )
-            packCheckSeq.Members += [upVelo]
-
-            from Configurables import DataPacking__Check_LHCb__MCVeloHitPacker_
-            cVelo = DataPacking__Check_LHCb__MCVeloHitPacker_("CheckVeloHits"+slot)
-            packCheckSeq.Members += [cVelo]
-
-
-
-
-#"""
-#><<         ><< ><<<<<<<< ><<           ><<<<      ><<<<<<<
-# ><<       ><<  ><<       ><<         ><<    ><<   ><<    ><<  ><
-#  ><<     ><<   ><<       ><<       ><<        ><< ><<    ><<     ><<   ><<
-#   ><<   ><<    ><<<<<<   ><<       ><<        ><< ><<<<<<<   ><<   >< ><<
-#    ><< ><<     ><<       ><<       ><<        ><< ><<        ><<    ><
-#     ><<<<      ><<       ><<         ><<     ><<  ><<        ><<  ><  ><<
-#      ><<       ><<<<<<<< ><<<<<<<<     ><<<<      ><<        ><< ><<   ><<
-#"""
-
-
-    def defineVPGeo( self, detPieces ):
-        self.removeBeamPipeElements( "velo" )
-        if detPieces.has_key('BeforeMagnetRegion'):
-            detPieces['BeforeMagnetRegion'] += ['VP']
-
-
-
-
-    def configureVPSim( self, slot, detHits ):
-        region = "BeforeMagnetRegion"
-        det = "VP"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-
-
-
-
-    def configureVPMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        ## in case of a non default detector, need to be overwritten
-        #detMoniSeq = GaudiSequencer( "DetectorsMonitor" + slot )
-        from Configurables import VPGaussMoni
-        detMoniSeq.Members += [ VPGaussMoni( "VPGaussMoni" + slot ) ]
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCVPHitPacker_
-            checkHits.VeloHits =  'MC/VP/Hits'
-            # This is not done in the PuVeto Moni config
-            #checkHits.PuVetoHits = ''
-            upVP = DataPacking__Unpack_LHCb__MCVPHitPacker_("UnpackVPHits"+slot,
-                                                                      OutputName = "MC/VP/HitsTest" )
-            packCheckSeq.Members += [upVP]
-
-            from Configurables import DataPacking__Check_LHCb__MCVPHitPacker_
-            cVP = DataPacking__Check_LHCb__MCVPHitPacker_("CheckVPHits"+slot)
-            packCheckSeq.Members += [cVP]
-
-
-
-#"""
-#  ><<<<<<<     ><<     ><<    ><<     ><<
-#  ><<    ><<   ><<  ><<   ><< ><<     ><<
-#  ><<    ><<   ><< ><<        ><<     ><<
-#  >< ><<       ><< ><<        ><<<<<< ><<
-#  ><<  ><<     ><< ><<        ><<     ><<
-#  ><<    ><<   ><<  ><<   ><< ><<     ><<
-#  ><<      ><< ><<    ><<<<   ><<     ><<
-#
-#"""
-
-
-    def defineRich1GeoDet( self , detPieces ):
-        self.removeBeamPipeElements( "rich1" )
-        detPieces['BeforeMagnetRegion']+=['Rich1']
-
-    def defineRich1GeoStream( self ):
-        self._listOfGeoObjects_.append("/dd/Geometry/BeforeMagnetRegion/Rich1/Rich1Surfaces")
-        self._listOfGeoObjects_.append("/dd/Geometry/BeforeMagnetRegion/Rich1/RichHPDSurfaces")
-
-    def defineRich2GeoDet( self , detPieces ):
-        self.removeBeamPipeElements( "rich2" )
-        detPieces['AfterMagnetRegion']+=['Rich2']
-
-    def defineRich2GeoStream( self ):
-        self._listOfGeoObjects_.append("/dd/Geometry/AfterMagnetRegion/Rich2/Rich2Surfaces")
-
-    def defineRichPhys( self, gmpl ):
-        gmpl.PhysicsConstructors.append("GiGaPhysConstructorOp")
-        gmpl.PhysicsConstructors.append("GiGaPhysConstructorHpd")
-
-    ##
-    ##
-    def configureRichSim (self, slot, detHits ):
-        from Configurables import (
-            GetMCRichHitsAlg,
-            GetMCRichOpticalPhotonsAlg,
-            GetMCRichSegmentsAlg,
-            GetMCRichTracksAlg
-            )
-
-        #for slot in SpillOverSlots:
-        richHitsSeq = GaudiSequencer( "RichHits" + slot )
-        detHits.Members += [ richHitsSeq ]
-        richHitsSeq.Members = [ GetMCRichHitsAlg( "GetRichHits"+slot),
-                                GetMCRichOpticalPhotonsAlg("GetRichPhotons"+slot),
-                                GetMCRichSegmentsAlg("GetRichSegments"+slot),
-                                GetMCRichTracksAlg("GetRichTracks"+slot),
-                                Rich__MC__MCPartToMCRichTrackAlg("MCPartToMCRichTrack"+slot),
-                                Rich__MC__MCRichHitToMCRichOpPhotAlg("MCRichHitToMCRichOpPhot"+slot) ]
-
-
-    def configureRichMoni ( self, slot, packCheckSeq, detMoniSeq, checkHits, configuredRichMoni ):
-
-        # reinstate checkHits default value
-        checkHits.RichHits = 'MC/Rich/Hits'
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            from Configurables import DataPacking__Unpack_LHCb__MCRichHitPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichOpticalPhotonPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichSegmentPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichTrackPacker_
-
-            upRichHit  = DataPacking__Unpack_LHCb__MCRichHitPacker_("UnpackRichHits"+slot,
-                                                                    OutputName = "MC/Rich/HitsTest" )
-            upRichOpPh = DataPacking__Unpack_LHCb__MCRichOpticalPhotonPacker_("UnpackRichOpPhot"+slot,
-                                                                              OutputName = "MC/Rich/OpticalPhotonsTest" )
-            upRichSeg  = DataPacking__Unpack_LHCb__MCRichSegmentPacker_("UnpackRichSegments"+slot,
-                                                                        OutputName = "MC/Rich/SegmentsTest" )
-            upRichTrk  = DataPacking__Unpack_LHCb__MCRichTrackPacker_("UnpackRichTracks"+slot,
-                                                                      OutputName = "MC/Rich/TracksTest" )
-            packCheckSeq.Members += [upRichHit,upRichOpPh,upRichSeg,upRichTrk]
+            outputFile = Gaussino().outputName() + fileExtension
 
+        # Merge genFSRs
+        if self.getProp("WriteFSR"):
+            seqGenFSR = GaudiSequencer("GenFSRSeq")
+            ApplicationMgr().TopAlg += [seqGenFSR]
 
-            from Configurables import DataPacking__Check_LHCb__MCRichHitPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichOpticalPhotonPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichSegmentPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichTrackPacker_
-            cRichHit  = DataPacking__Check_LHCb__MCRichHitPacker_("CheckRichHits"+slot )
-            cRichOpPh = DataPacking__Check_LHCb__MCRichOpticalPhotonPacker_("CheckRichOpPhot"+slot )
-            cRichSeg  = DataPacking__Check_LHCb__MCRichSegmentPacker_("CheckRichSegments"+slot )
-            cRichTrk  = DataPacking__Check_LHCb__MCRichTrackPacker_("CheckRichTracks"+slot )
-            packCheckSeq.Members += [cRichHit,cRichOpPh,cRichSeg,cRichTrk]
-        # Out of loop
-        if ( self.getProp("CurrentRICHSimRunOption") == "clunker" ):
-            if not configuredRichMoni[1]:
-                importOptions("$GAUSSRICHROOT/options/RichAnalysis.opts")
-                configuredRichMoni[1] = True
-        elif (GaussRICHConf().getProp("MakeRichG4MonitorHistoSet2") ):
-            if not configuredRichMoni[1]:
-                configuredRichMoni[1] = True
-
-#"""
-#  ><<<<<<<     ><<     ><<    ><<     ><<    ><<<<<<<   ><<       ><< ><<< ><<<<<<
-#  ><<    ><<   ><<  ><<   ><< ><<     ><<    ><<    ><< >< ><<   ><<<      ><<
-#  ><<    ><<   ><< ><<        ><<     ><<    ><<    ><< ><< ><< > ><<      ><<
-#  >< ><<       ><< ><<        ><<<<<< ><<    ><<<<<<<   ><<  ><<  ><<      ><<
-#  ><<  ><<     ><< ><<        ><<     ><<    ><<        ><<   ><  ><<      ><<
-#  ><<    ><<   ><<  ><<   ><< ><<     ><<    ><<        ><<       ><<      ><<
-#  ><<      ><< ><<    ><<<<   ><<     ><<    ><<        ><<       ><<      ><<
-#
-#"""
-
-    def defineRich1MaPmtGeoDet( self , detPieces ):
-        self.removeBeamPipeElements( "rich1" )
-        detPieces['BeforeMagnetRegion']+=['Rich1']
-
-    def defineRich1MaPmtGeoStream( self, geoCnvSvc ):
-        self._listOfGeoObjects_.append("/dd/Geometry/BeforeMagnetRegion/Rich1/Rich1Surfaces")
-        self._listOfGeoObjects_.append("/dd/Geometry/BeforeMagnetRegion/Rich1/RichPMTSurfaces")
-        geoCnvSvc.UseAlignment = False
-        geoCnvSvc.AlignAllDetectors = False
-
-
-    def defineRich2MaPmtGeoDet( self , detPieces ):
-        self.removeBeamPipeElements( "rich2" )
-        detPieces['AfterMagnetRegion']+=['Rich2']
-
-    def defineRich2MaPmtGeoStream( self, geoCnvSvc ):
-        self._listOfGeoObjects_.append("/dd/Geometry/AfterMagnetRegion/Rich2/Rich2Surfaces")
-        geoCnvSvc.UseAlignment = False
-        geoCnvSvc.AlignAllDetectors = False
-
-
-    def defineRichMaPmtPhys( self, gmpl):
-        gmpl.PhysicsConstructors.append("GiGaPhysConstructorOpCkv")
-        gmpl.PhysicsConstructors.append("GiGaPhysConstructorPhotoDetector")
-
-
-
-
-    def configureRichMaPmtSim (self, slot, detHits ):
-        from Configurables import (
-            GetMCCkvHitsAlg,
-            GetMCCkvOpticalPhotonsAlg,
-            GetMCCkvSegmentsAlg,
-            GetMCCkvTracksAlg
-            )
-        richHitsSeq = GaudiSequencer( "RichHits" + slot )
-        detHits.Members += [ richHitsSeq ]
-        richHitsSeq.Members = [ GetMCCkvHitsAlg( "GetRichHits"+slot),
-                                GetMCCkvOpticalPhotonsAlg("GetRichPhotons"+slot),
-                                GetMCCkvSegmentsAlg("GetRichSegments"+slot),
-                                GetMCCkvTracksAlg("GetRichTracks"+slot),
-                                Rich__MC__MCPartToMCRichTrackAlg("MCPartToMCRichTrack"+slot),
-                                Rich__MC__MCRichHitToMCRichOpPhotAlg("MCRichHitToMCRichOpPhot"+slot) ]
-
-
-    def configureRichMaPmtMoni ( self, slot, packCheckSeq, detMoniSeq, checkHits, configuredRichMoni ):
-        checkHits.RichHits = 'MC/Rich/Hits'
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            from Configurables import DataPacking__Unpack_LHCb__MCRichHitPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichOpticalPhotonPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichSegmentPacker_
-            from Configurables import DataPacking__Unpack_LHCb__MCRichTrackPacker_
-
-            upRichHit  = DataPacking__Unpack_LHCb__MCRichHitPacker_("UnpackRichHits"+slot,
-                                                                    OutputName = "MC/Rich/HitsTest" )
-            upRichOpPh = DataPacking__Unpack_LHCb__MCRichOpticalPhotonPacker_("UnpackRichOpPhot"+slot,
-                                                                              OutputName = "MC/Rich/OpticalPhotonsTest" )
-            upRichSeg  = DataPacking__Unpack_LHCb__MCRichSegmentPacker_("UnpackRichSegments"+slot,
-                                                                        OutputName = "MC/Rich/SegmentsTest" )
-            upRichTrk  = DataPacking__Unpack_LHCb__MCRichTrackPacker_("UnpackRichTracks"+slot,
-                                                                      OutputName = "MC/Rich/TracksTest" )
-            packCheckSeq.Members += [upRichHit,upRichOpPh,upRichSeg,upRichTrk]
-
-
-            from Configurables import DataPacking__Check_LHCb__MCRichHitPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichOpticalPhotonPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichSegmentPacker_
-            from Configurables import DataPacking__Check_LHCb__MCRichTrackPacker_
-            cRichHit  = DataPacking__Check_LHCb__MCRichHitPacker_("CheckRichHits"+slot )
-            cRichOpPh = DataPacking__Check_LHCb__MCRichOpticalPhotonPacker_("CheckRichOpPhot"+slot )
-            cRichSeg  = DataPacking__Check_LHCb__MCRichSegmentPacker_("CheckRichSegments"+slot )
-            cRichTrk  = DataPacking__Check_LHCb__MCRichTrackPacker_("CheckRichTracks"+slot )
-            packCheckSeq.Members += [cRichHit,cRichOpPh,cRichSeg,cRichTrk]
-        # Out of indent
-
-
-        if ( self.getProp("UpgradeRICHSimRunOption") == "clunker" ):
-            if not configuredRichMoni[1]:
-                importOptions("$GAUSSCHERENKOVROOT/options/GaussCherenkovAnalysis.opts")
-                configuredRichMoni[1] = True
-        elif (GaussCherenkovConf().getProp("MakeCkvG4MonitorHistoSet2")):
-            if not configuredRichMoni[1]:
-                configuredRichMoni[1] = True
-
-
-
-#"""
-#><<< ><<<<<<     ><<<<      ><<<<<<<         ><<    ><<     ><<
-#     ><<       ><<    ><<   ><<    ><<    ><<   ><< ><<     ><<
-#     ><<     ><<        ><< ><<    ><<   ><<        ><<     ><<
-#     ><<     ><<        ><< >< ><<       ><<        ><<<<<< ><<
-#     ><<     ><<        ><< ><<  ><<     ><<        ><<     ><<
-#     ><<       ><<     ><<  ><<    ><<    ><<   ><< ><<     ><<
-#     ><<         ><<<<      ><<      ><<    ><<<<   ><<     ><<
-#
-#"""
-    def defineTorchGeo( self ):
-        log.warning("Geo not defined for TORCH")
-        pass
-
-    def configureTorchSim( self, slot, detHits ):
-        log.warning("Sim not defined for TORCH")
-        pass
-
-    def configureTorchMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        #detMoniSeq = GaudiSequencer( "DetectorsMonitor" + slot )
-        log.warning ("Moni not defined for TORCH")
-        pass
-
-
-
-
-#"""
-#><<< ><<<<<< ><<< ><<<<<<
-#     ><<          ><<
-#     ><<          ><<
-#     ><<          ><<
-#     ><<          ><<
-#     ><<          ><<
-#     ><<          ><<
-#"""
-
-
-    def defineTTGeo( self , detPieces ):
-        self.removeBeamPipeElements( "tt" )
-        if 'TT' not in detPieces['BeforeMagnetRegion']:
-            detPieces['BeforeMagnetRegion']+=['TT']
-
-
-    def configureTTSim( self, slot, detHits ):
-        region   = "BeforeMagnetRegion"
-        det = "TT"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-    def configureTTMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.TTHits = 'MC/TT/Hits'
-
-        myZStations = [
-            2350.0*SystemOfUnits.mm,
-            2620.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 150.*SystemOfUnits.cm
-        myZStationYMax = 150.*SystemOfUnits.cm
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "TTHitMonitor" + slot ,
-                mcPathString = "MC/TT/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-
-            from Configurables import DataPacking__Unpack_LHCb__MCTTHitPacker_
-            from Configurables import DataPacking__Check_LHCb__MCTTHitPacker_
-            upTT   = DataPacking__Unpack_LHCb__MCTTHitPacker_("UnpackTTHits"+slot,
-                                                              OutputName = "MC/TT/HitsTest" )
-            cTT   = DataPacking__Check_LHCb__MCTTHitPacker_("CheckTTHits"+slot )
-            packCheckSeq.Members += [upTT, cTT]
-
-
-
-#"""
-# ><<     ><< ><<< ><<<<<<
-# ><<     ><<      ><<
-# ><<     ><<      ><<
-# ><<     ><<      ><<
-# ><<     ><<      ><<
-# ><<     ><<      ><<
-#   ><<<<<         ><<
-#"""
-
-
-    def defineUTGeo( self , detPieces ):
-        self.removeBeamPipeElements( "ut" )
-        if 'UT' not in detPieces['BeforeMagnetRegion']:
-            detPieces['BeforeMagnetRegion']+=['UT']
-
-
-    def configureUTSim( self, slot, detHits ):
-        region   = "BeforeMagnetRegion"
-        det = "UT"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-    def configureUTMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.UTHits = 'MC/UT/Hits'
-
-        myZStations = [
-            2350.0*SystemOfUnits.mm,
-            2620.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 150.*SystemOfUnits.cm
-        myZStationYMax = 150.*SystemOfUnits.cm
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "UTHitMonitor" + slot ,
-                mcPathString = "MC/UT/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-
-            from Configurables import DataPacking__Unpack_LHCb__MCUTHitPacker_
-            from Configurables import DataPacking__Check_LHCb__MCUTHitPacker_
-            upUT   = DataPacking__Unpack_LHCb__MCUTHitPacker_("UnpackUTHits"+slot,
-                                                              OutputName = "MC/UT/HitsTest" )
-            cUT   = DataPacking__Check_LHCb__MCUTHitPacker_("CheckUTHits"+slot )
-            packCheckSeq.Members += [upUT, cUT]
-
-
-
-
-#"""
-#  ><<  ><<< ><<<<<<
-#  ><<       ><<
-#  ><<       ><<
-#  ><<       ><<
-#  ><<       ><<
-#  ><<       ><<
-#  ><<       ><<
-#
-#"""
-
-    def defineITGeo( self , detPieces ):
-        self.removeBeamPipeElements( "t" )
-        region = "AfterMagnetRegion"
-        if 'T' not in detPieces[region]:
-            detPieces[region]+=['T/IT']
-        if 'T/PipeInT' not in detPieces[region]:
-            detPieces[region]+=['T/PipeInT']
-
-
-    def configureITSim( self, slot, detHits ):
-        region   = "AfterMagnetRegion/T"
-        det = "IT"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-    def configureITMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.ITHits = 'MC/IT/Hits'
-
-        myZStations = [
-            7780.0*SystemOfUnits.mm,
-            8460.0*SystemOfUnits.mm,
-            9115.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 150.*SystemOfUnits.cm
-        myZStationYMax = 150.*SystemOfUnits.cm
-
-        # Upgrade
-        #if self.getProp("DataType") == "Upgrade" :
-        #    myZStations = [
-        #        8015.0*SystemOfUnits.mm,
-        #        8697.0*SystemOfUnits.mm,
-        #        9363.0*SystemOfUnits.mm
-        #        ]
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "ITHitMonitor" + slot ,
-                mcPathString = "MC/IT/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCITHitPacker_
-            upIT   = DataPacking__Unpack_LHCb__MCITHitPacker_("UnpackITHits"+slot,
-                                                              OutputName = "MC/IT/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCITHitPacker_
-            cIT   = DataPacking__Check_LHCb__MCITHitPacker_("CheckITHits"+slot )
-            packCheckSeq.Members += [upIT, cIT]
-
-
-#"""
-#
-#     Si IT
-#
-#"""
-
-    def defineSLGeo( self , detPieces ):
-        self.removeBeamPipeElements( "t" )
-        region = "AfterMagnetRegion"
-        if 'T' not in detPieces[region]:
-            detPieces[region]+=['T/SL']
-        # PSZ - line below might need to go depending on SL definition
-        if 'T/PipeInT' not in detPieces[region]:
-            detPieces[region]+=['T/PipeInT']
-
-
-    def configureSLSim( self, slot, detHits ):
-        region   = "AfterMagnetRegion/T"
-        det = "SL"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-        pass
-
-    #def configureSLMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-    #    pass
-    def configureSLMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.SLHits = 'MC/SL/Hits'
-
-        myZStations = [
-            7780.0*SystemOfUnits.mm,
-            #8460.0*SystemOfUnits.mm,
-            9115.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 150.*SystemOfUnits.cm
-        myZStationYMax = 150.*SystemOfUnits.cm
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "SLHitMonitor" + slot ,
-                mcPathString = "MC/SL/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCSLHitPacker_
-            upSL   = DataPacking__Unpack_LHCb__MCSLHitPacker_("UnpackSLHits"+slot,
-                                                              OutputName = "MC/SL/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCSLHitPacker_
-            cSL   = DataPacking__Check_LHCb__MCSLHitPacker_("CheckSLHits"+slot )
-            packCheckSeq.Members += [upSL, cSL]
-
-
-
-#"""
-#   ><<<<<<<< ><<< ><<<<<<
-#   ><<            ><<
-#   ><<            ><<
-#   ><<<<<<        ><<
-#   ><<            ><<
-#   ><<            ><<
-#   ><<            ><<
-#
-#"""
-    def defineFTGeo( self , detType , detPieces ):
-        self.removeBeamPipeElements( "t" )
-        region = "AfterMagnetRegion"
-        if 'T' not in detPieces[region]:
-            detPieces[region]+=['T/FT']
-        if 'T/PipeInT' not in detPieces[region]:
-            detPieces[region]+=['T/PipeInT']
-        if detType == "ft":
-            region = "DownstreamRegion"
-            detPieces[region]+=['NeutronShielding']
-
-
-    def configureFTSim( self, slot, detHits ):
-        region   = "AfterMagnetRegion/T"
-        det = "FT"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-    def configureFTMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.FTHits = 'MC/FT/Hits'
-
-
-        # Upgrade
-        myZStations = [
-            7938.0*SystemOfUnits.mm,
-            8625.0*SystemOfUnits.mm,
-            9315.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 100.*SystemOfUnits.cm
-        myZStationYMax = 100.*SystemOfUnits.cm
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "FTHitMonitor" + slot ,
-                mcPathString = "MC/FT/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCFTHitPacker_
-            upFT = DataPacking__Unpack_LHCb__MCFTHitPacker_("UnpackFTHits"+slot,
-                                                              OutputName = "MC/FT/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCFTHitPacker_
-            cFT  = DataPacking__Check_LHCb__MCFTHitPacker_("CheckFTHits"+slot )
-            packCheckSeq.Members += [upFT, cFT]
-
-
-#"""
-#    ><<<<      ><<< ><<<<<<
-#  ><<    ><<        ><<
-#><<        ><<      ><<
-#><<        ><<      ><<
-#><<        ><<      ><<
-#  ><<     ><<       ><<
-#    ><<<<           ><<
-#"""
-
-    def defineOTGeo( self , detPieces ):
-        self.removeBeamPipeElements( "t" )
-        region = "AfterMagnetRegion"
-        if 'T' not in detPieces[region]:
-            detPieces[region]+=['T/OT']
-        if 'T/PipeInT' not in detPieces[region]:
-            detPieces[region]+=['T/PipeInT']
-
-
-
-    def configureOTSim( self, slot, detHits ):
-        region   = "AfterMagnetRegion/T"
-        det = "OT"
-        moni = GetTrackerHitsAlg(
-            'Get' + det + 'Hits' + slot,
-            MCHitsLocation = 'MC/' + det  + '/Hits',
-            CollectionName = det + 'SDet/Hits',
-            Detectors = [ '/dd/Structure/LHCb/' + region + '/' + det ]
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-    def configureOTMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.OTHits = 'MC/OT/Hits'
-
-        myZStations = [
-            7938.0*SystemOfUnits.mm,
-            8625.0*SystemOfUnits.mm,
-            9315.0*SystemOfUnits.mm
-            ]
-        myZStationXMax = 100.*SystemOfUnits.cm
-        myZStationYMax = 100.*SystemOfUnits.cm
-
-        # Upgrade
-        #if self.getProp("DataType") == "Upgrade" :
-        #    myZStations = [
-        #        7672.0*SystemOfUnits.mm,
-        #        8354.0*SystemOfUnits.mm,
-        #        9039.0*SystemOfUnits.mm
-        #        ]
-
-        detMoniSeq.Members += [
-            MCHitMonitor(
-                "OTHitMonitor" + slot ,
-                mcPathString = "MC/OT/Hits",
-                zStations = myZStations,
-                xMax = myZStationXMax,
-                yMax = myZStationYMax
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCOTHitPacker_
-            upOT   = DataPacking__Unpack_LHCb__MCOTHitPacker_("UnpackOTHits"+slot,
-                                                              OutputName = "MC/OT/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCOTHitPacker_
-            cOT   = DataPacking__Check_LHCb__MCOTHitPacker_("CheckOTHits"+slot )
-            packCheckSeq.Members += [upOT, cOT]
-
-
-
-#"""
-#   ><<       ><<
-#   >< ><<   ><<<
-#   ><< ><< > ><< ><<  ><<    ><<     ><< ><<
-#   ><<  ><<  ><< ><<  ><<  ><<  ><<   ><<  ><<
-#   ><<   ><  ><< ><<  ><< ><<    ><<  ><<  ><<
-#   ><<       ><< ><<  ><<  ><<  ><<   ><<  ><<
-#   ><<       ><<   ><<><<    ><<     ><<<  ><<
-#
-#"""
-
-    def defineMuonGeo( self, detPieces ):
-        #self.removeBeamPipeElements( "muon" )
-        region = 'DownstreamRegion'
-        detPieces[region]+=['Muon']
-
-
-    def configureMuonSim ( self, slot, detHits ):
-        det = "Muon"
-        moni = GetTrackerHitsAlg( "Get"+det+"Hits"+slot,
-                                  MCHitsLocation = 'MC/' + det + '/Hits',
-                                  CollectionName = det + 'SDet/Hits',
-                                  Detectors = ['/dd/Structure/LHCb/DownstreamRegion/'+det] )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-
-    def configureMuonMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        det = "Muon"
-        checkHits.MuonHits = 'MC/Muon/Hits'
-
-        detMoniSeq.Members += [ MuonHitChecker( det + "HitChecker" + slot,
-                                                FullDetail = True )]
-## The following should only be done in expert checks
-#        from Configurables import MuonMultipleScatteringChecker
-#        detMoniSeq.Members += [
-#            MuonMultipleScatteringChecker( "MuonMultipleScatteringChecker"+ slot )]
-
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-
-            from Configurables import DataPacking__Unpack_LHCb__MCMuonHitPacker_
-            upMu   = DataPacking__Unpack_LHCb__MCMuonHitPacker_("UnpackMuonHits"+slot,
-                                                                OutputName = "MC/Muon/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCMuonHitPacker_
-            cMu   = DataPacking__Check_LHCb__MCMuonHitPacker_("CheckMuonHits"+slot )
-            packCheckSeq.Members += [upMu, cMu]
-
-
-
-
-#"""
-#       ><<          ><        ><<           ><<<<
-#    ><<   ><<      >< <<      ><<         ><<    ><<
-#   ><<            ><  ><<     ><<       ><<        ><<
-#   ><<           ><<   ><<    ><<       ><<        ><<
-#   ><<          ><<<<<< ><<   ><<       ><<        ><<
-#    ><<   ><<  ><<       ><<  ><<         ><<     ><<
-#      ><<<<   ><<         ><< ><<<<<<<<     ><<<<
-#
-#"""
-
-    def defineSpdGeo( self, detPieces ):
-        self.removeBeamPipeElements("calo")
-        region = 'DownstreamRegion'
-        detPieces[region]+=['Spd']
-        detPieces[region]+=['Converter']
-
-    def definePrsGeo( self, detPieces ):
-        region = 'DownstreamRegion'
-        detPieces[region]+=['Prs']
-
-    def defineEcalGeo( self, detPieces ):
-        region = 'DownstreamRegion'
-        detPieces[region]+=['Ecal']
-
-    def defineHcalGeo( self, detPieces ):
-        region = 'DownstreamRegion'
-        detPieces[region]+=['Hcal']
-
-
-    def configureSpdSim ( self, slot, detHits ):
-        det = "Spd"
-        moni = GetCaloHitsAlg(
-            "Get"+det+"Hits"+slot,
-            MCHitsLocation = 'MC/' + det + '/Hits',
-            CollectionName = det + 'Hits'
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mccalohits(slot, 'MC/' + det + '/Hits')
-
-    def configurePrsSim ( self, slot, detHits ):
-        det = "Prs"
-        moni = GetCaloHitsAlg(
-            "Get"+det+"Hits"+slot,
-            MCHitsLocation = 'MC/' + det + '/Hits',
-            CollectionName = det + 'Hits'
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mccalohits(slot, 'MC/' + det + '/Hits')
+            if self.getProp("MergeGenFSR"):
+                seqGenFSR.Members += ["GenFSRMerge"]
 
-    def configureEcalSim ( self, slot, detHits ):
-        det = "Ecal"
-        moni = GetCaloHitsAlg(
-            "Get"+det+"Hits"+slot,
-            MCHitsLocation = 'MC/' + det + '/Hits',
-            CollectionName = det + 'Hits'
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mccalohits(slot, 'MC/' + det + '/Hits')
+        IOHelper().outStream(outputFile, simWriter, self.getProp("WriteFSR"))
 
-    def configureHcalSim ( self, slot, detHits ):
-        det = "Hcal"
-        moni = GetCaloHitsAlg(
-            "Get"+det+"Hits"+slot,
-            MCHitsLocation = 'MC/' + det + '/Hits',
-            CollectionName = det + 'Hits'
-            )
-        detHits.Members += [ moni ]
-        self.configure_redecay_mccalohits(slot, 'MC/' + det + '/Hits')
+        if not FileCatalog().isPropertySet("Catalogs"):
+            FileCatalog().Catalogs = ["xmlcatalog_file:NewCatalog.xml"]
 
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [simWriter]
 
+    # Apply the configuration
+    def __apply_configuration__(self):
 
+        self.setOtherProps(Gaussino(), [
+            "Histograms", "DatasetName", "Phases", "SpilloverPaths", "EvtMax",
+            "EnableHive", "ThreadPoolSize", "EventSlots", "ConvertEDM"])
 
-    def configureSpdMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.CaloHits.append('MC/Spd/Hits')
+        LHCbApp().Simulation = True
+        self.setOtherProps(LHCbApp(), [
+            "EvtMax", "EnableHive", "ThreadPoolSize", "DataType"])
 
-        det = "Spd"
-        detMoniSeq.Members += [
-            MCCaloMonitor(
-                det + "Monitor" + slot,
-                OutputLevel = 4,
-                Detector = det,
-                Regions = True,
-                MaximumEnergy = 10.*SystemOfUnits.MeV,
-                Threshold = 1.5*SystemOfUnits.MeV
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
+        # Propagate beam settings for compatibility with existing option files
+        from Gaussino.Generation import GenPhase
+        self.setOtherProps(GenPhase(), [
+            "BeamMomentum", "BeamHCrossingAngle", "BeamVCrossingAngle",
+            "BeamEmittance", "BeamBetaStar", "BeamLineAngles",
+            "InteractionPosition", "BunchRMS", "Luminosity",
+            "TotalCrossSection", "B2Momentum", "B1Particle", "B2Particle"])
 
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCSpdHitPacker_
-            upSpd  = DataPacking__Unpack_LHCb__MCSpdHitPacker_("UnpackSpdHits"+slot,
-                                                               OutputName = "MC/Spd/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCSpdHitPacker_
-            cSpd  = DataPacking__Check_LHCb__MCSpdHitPacker_("CheckSpdHits"+slot)
-            packCheckSeq.Members += [upSpd,cSpd]
+        # Propagates and sets up SimConf to be able to configure the
+        # OutputStream during its apply_configuration
+        self.propagateSimConf()
 
+        # Trigger the simulation related configuration if simulation is in
+        # phases
+        if "Simulation" in Gaussino().getProp("Phases"):
+            from Gauss import G4Physics
+            G4Physics().apply()
+            from Gauss.Geometry import LHCbGeo
+            LHCbGeo().setOtherProps(LHCbApp(), ['DetectorGeo'])
+            LHCbGeo().apply()
 
+        crossingList = self.defineCrossingList()
 
-    def configurePrsMoni( self, slot, packCheckSeq, detMoniSeq, checkHits):
-        # reinstate checkHits default value
-        checkHits.CaloHits.append('MC/Prs/Hits')
-
-        det = "Prs"
-        detMoniSeq.Members += [
-            MCCaloMonitor(
-                det + "Monitor" + slot,
-                OutputLevel = 4,
-                Detector = 'Prs',
-                Regions = True,
-                MaximumEnergy = 10.*SystemOfUnits.MeV,
-                Threshold = 1.5*SystemOfUnits.MeV
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCPrsHitPacker_
-            upPrs  = DataPacking__Unpack_LHCb__MCPrsHitPacker_("UnpackPrsHits"+slot,
-                                                               OutputName = "MC/Prs/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCPrsHitPacker_
-            cPrs  = DataPacking__Check_LHCb__MCPrsHitPacker_("CheckPrsHits"+slot)
-            packCheckSeq.Members += [upPrs,cPrs]
-
-
-
-
-    def configureEcalMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.CaloHits.append('MC/Ecal/Hits')
-
-        det = "Ecal"
-        detMoniSeq.Members += [
-            MCCaloMonitor(
-                det + "Monitor" + slot,
-                OutputLevel = 4,
-                Detector = det,
-                Regions = True,
-                MaximumEnergy = 1000.*SystemOfUnits.MeV,
-                Threshold = 10.*SystemOfUnits.MeV
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCEcalHitPacker_
-            upEcal = DataPacking__Unpack_LHCb__MCEcalHitPacker_("UnpackEcalHits"+slot,
-                                                                OutputName = "MC/Ecal/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCEcalHitPacker_
-            cEcal = DataPacking__Check_LHCb__MCEcalHitPacker_("CheckEcalHits"+slot)
-            packCheckSeq.Members += [upEcal,cEcal]
-
-
-
-
-    def configureHcalMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-        # reinstate checkHits default value
-        checkHits.CaloHits.append('MC/Hcal/Hits')
-
-        det = "Hcal"
-        detMoniSeq.Members += [
-            MCCaloMonitor(
-                det + "Monitor" + slot,
-                OutputLevel = 4,
-                Detector = det,
-                Regions = True,
-                MaximumEnergy = 1000.*SystemOfUnits.MeV,
-                Threshold = 5.*SystemOfUnits.MeV
-                )
-            ]
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-            packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-            from Configurables import DataPacking__Unpack_LHCb__MCHcalHitPacker_
-            upHcal = DataPacking__Unpack_LHCb__MCHcalHitPacker_("UnpackHcalHits"+slot,
-                                                                OutputName = "MC/Hcal/HitsTest" )
-            from Configurables import DataPacking__Check_LHCb__MCHcalHitPacker_
-            cHcal = DataPacking__Check_LHCb__MCHcalHitPacker_("CheckHcalHits"+slot)
-            packCheckSeq.Members += [upHcal,cHcal]
-
-
-########################################################################################################
-#
-# Herschel
-#
-########################################################################################################
-
-    def defineHCGeo(self, detPieces):
-      year = self.getProp("DataType")
-      if year not in self.Run2DataTypes:
-        log.warning( "Check your options: you have asked to simulate Herschel but not in %s."%year )
-        log.warning( "Simulating only the LHC tunnel.")
-      # Add the non-standard pieces of the BeforeMagnet region.
-      region = 'BeforeMagnetRegion'
-      if detPieces.has_key(region):
-        pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-      # Add the AfterMuon part of the Downstream region.
-      region = 'DownstreamRegion'
-      if detPieces.has_key(region):
-        pieces = ['AfterMuon']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-      # Add the entire Upstream, BeforeUpstream, and AfterDownstream regions.
-      regions = ['UpstreamRegion', 'BeforeUpstreamRegion',
-                 'AfterDownstreamRegion']
-      for region in regions:
-        if detPieces.has_key(region):
-          detPieces[region] = []
-        self._listOfGeoObjects_.append("/dd/Structure/LHCb/" + region)
-
-      # Extend the world volume.
-      if self.getProp('UseGaussGeo'):
-        GaussGeo().ZsizeOfWorldVolume = 300.0 * SystemOfUnits.m
-      else:
-        GiGaGeo().ZsizeOfWorldVolume = 300.0 * SystemOfUnits.m
-
-    def configureHCSim(self, slot, detHits):
-      year = self.getProp("DataType")
-      if year not in self.Run2DataTypes:
-        raise RuntimeError( "Asking to simulate Herschel response but not present in %s" %year )
-
-      det = "HC"
-      getHits = GetTrackerHitsAlg("Get" + det + "Hits" + slot)
-      getHits.MCHitsLocation = "MC/" + det + "/Hits"
-      getHits.CollectionName = det + "SDet/Hits"
-      getHits.Detectors = ["/dd/Structure/LHCb/UpstreamRegion/HCB0",
-                           "/dd/Structure/LHCb/UpstreamRegion/HCB1",
-                           "/dd/Structure/LHCb/BeforeUpstreamRegion/HCB2",
-                           "/dd/Structure/LHCb/DownstreamRegion/AfterMuon/HCF1",
-                           "/dd/Structure/LHCb/AfterDownstreamRegion/HCF2"]
-      detHits.Members += [getHits]
-
-    def configureHCMoni(self, slot, packCheckSeq, detMoniSeq, checkHits):
-      from Configurables import HCHitChecker
-      detMoniSeq.Members += [HCHitChecker("HCHitChecker" + slot)]
-
-      if self.getProp("EnablePack") and self.getProp("DataPackingChecks"):
-        packCheckSeq = GaudiSequencer("DataUnpackTest" + slot)
-        from Configurables import DataPacking__Unpack_LHCb__MCHCHitPacker_
-        upHC = DataPacking__Unpack_LHCb__MCHCHitPacker_("UnpackHCHits" + slot,
-                                                        OutputName = "MC/HC/HitsTest")
-        packCheckSeq.Members += [upHC]
-
-        from Configurables import DataPacking__Check_LHCb__MCHCHitPacker_
-        cHC = DataPacking__Check_LHCb__MCHCHitPacker_("CheckHCHits" + slot)
-        packCheckSeq.Members += [cHC]
-
-
-########################################################################################################
-#
-# Beam Condition Monitors
-#
-########################################################################################################
-
-    def defineBcmGeo(self, detPieces):
-      # Add the non-standard pieces of the BeforeMagnet region.
-      region = 'BeforeMagnetRegion'
-      if detPieces.has_key(region):
-        pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-      # Add the entire Upstream region.
-      region = 'UpstreamRegion'
-      if detPieces.has_key(region):
-        detPieces[region] = []
-      self._listOfGeoObjects_.append("/dd/Structure/LHCb/" + region)
-      # Add the AfterMuon part of the Downstream region.
-      region = 'DownstreamRegion'
-      if detPieces.has_key(region):
-        pieces = ['AfterMuon']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-
-    def configureBcmSim(self, slot, detHits):
-      det = "Bcm"
-      getHits = GetTrackerHitsAlg("Get" + det + "Hits" + slot)
-      getHits.MCHitsLocation = "MC/" + det + "/Hits"
-      getHits.CollectionName = det + "SDet/Hits"
-      getHits.Detectors = ["/dd/Structure/LHCb/BeforeMagnetRegion/BeforeVelo/BcmUp",
-                           "/dd/Structure/LHCb/MagnetRegion/BcmDown"]
-      detHits.Members += [getHits]
-
-    def configureBcmMoni(self, slot, packCheckSeq, detMoniSeq, checkHits):
-      from Configurables import BcmHitChecker
-      checkerUp = BcmHitChecker("BcmHitCheckerUp" + slot)
-      checkerUp.BcmDetLocation = "/dd/Structure/LHCb/BeforeMagnetRegion/BeforeVelo/BcmUp"
-      checkerUp.MonitorInDetail = False
-      checkerDn = BcmHitChecker("BcmHitCheckerDown" + slot)
-      checkerDn.BcmDetLocation = "/dd/Structure/LHCb/MagnetRegion/BcmDown"
-      checkerDn.MonitorInDetail = False
-      detMoniSeq.Members += [checkerUp, checkerDn]
-
-      if self.getProp("EnablePack") and self.getProp("DataPackingChecks"):
-        packCheckSeq = GaudiSequencer("DataUnpackTest" + slot)
-        from Configurables import DataPacking__Unpack_LHCb__MCBcmHitPacker_
-        upBcm = DataPacking__Unpack_LHCb__MCBcmHitPacker_("UnpackBcmHits" + slot,
-                                                          OutputName = "MC/Bcm/HitsTest")
-        packCheckSeq.Members += [upBcm]
-
-        from Configurables import DataPacking__Check_LHCb__MCBcmHitPacker_
-        cBcm = DataPacking__Check_LHCb__MCBcmHitPacker_("CheckBcmHits" + slot)
-        packCheckSeq.Members += [cBcm]
-
-
-########################################################################################################
-#
-# Beam Loss Scintillators
-#
-########################################################################################################
-#
-
-    def defineBlsGeo(self, detPieces):
-      # Add the non-standard pieces of the BeforeMagnet region.
-      region = 'BeforeMagnetRegion'
-      if detPieces.has_key(region):
-        pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-      # Add the non-standard pieces of the Upstream region,
-      # unless the Upstream region has been added as a whole.
-      region = 'UpstreamRegion'
-      path = '/dd/Structure/LHCb/' + region
-      if detPieces.has_key(region) and path not in self._listOfGeoObjects_:
-        pieces = ['BlockWallUpstr']
-        for piece in pieces:
-          if piece in detPieces[region]: continue
-          detPieces[region] += [piece]
-
-    def configureBlsSim(self, slot, detHits):
-      det = "Bls"
-      getHits = GetTrackerHitsAlg("Get" + det + "Hits" + slot)
-      getHits.MCHitsLocation = "MC/" + det + "/Hits"
-      getHits.CollectionName = det + "SDet/Hits"
-      # The geometry of the BLS changed in 2011
-      idBLS = ["3", "4", "5", "6", "7", "8"]
-      if self.getProp("DataType") in [ "2009", "2010" ]:
-          idBLS = ["1", "2"]
-      getHits.Detectors = []
-      for iDet in idBLS:
-         getHits.Detectors.append("/dd/Structure/LHCb/BeforeMagnetRegion/BeforeVelo/Bls"+iDet)
-      detHits.Members += [getHits]
-
-
-    def configureBlsMoni(self, slot, packCheckSeq, detMoniSeq, checkHits):
-      from Configurables import BlsHitChecker
-      checkerA = BlsHitChecker("BlsHitCheckerBlsA" + slot)
-      checkerA.HistoDir = "BlsHitChecker/BlsHitCheckerBlsA"
-      checkerA.BlsAOn = TRUE
-      checkerA.HistogramTitlePrefix = "BlsA: "
-      checkerC = BlsHitChecker("BlsHitCheckerBlsC" + slot)
-      checkerC.HistoDir = "BlsHitChecker/BlsHitCheckerBlsC"
-      checkerC.BlsCOn = TRUE
-      checkerC.HistogramTitlePrefix = "BlsC: "
-      detMoniSeq.Members += [checkerA, checkerC]
-
-      if self.getProp("EnablePack") and self.getProp("DataPackingChecks"):
-        packCheckSeq = GaudiSequencer("DataUnpackTest" + slot)
-        from Configurables import DataPacking__Unpack_LHCb__MCBlsHitPacker_
-        upBls = DataPacking__Unpack_LHCb__MCBlsHitPacker_("UnpackBlsHits" + slot,
-                                                          OutputName = "MC/Bls/HitsTest")
-        packCheckSeq.Members += [upBls]
-
-        from Configurables import DataPacking__Check_LHCb__MCBlsHitPacker_
-        cBls = DataPacking__Check_LHCb__MCBlsHitPacker_("CheckBlsHits" + slot)
-        packCheckSeq.Members += [cBls]
-
-
-#"""
-#    ><<       ><<                                             ><<
-#    >< ><<   ><<<                                             ><<
-#    ><< ><< > ><<    ><<        ><<    ><< ><<      ><<     ><>< ><
-#    ><<  ><<  ><<  ><<  ><<   ><<  ><<  ><<  ><<  ><   ><<    ><<
-#    ><<   ><  ><< ><<   ><<  ><<   ><<  ><<  ><< ><<<<< ><<   ><<
-#    ><<       ><< ><<   ><<   ><<  ><<  ><<  ><< ><           ><<
-#    ><<       ><<   ><< ><<<      ><<  ><<<  ><<   ><<<<       ><<
-#                           ><<
-#"""
-
-    def defineMagnetGeo( self , basePieces, detPieces ):
-        # Turn off magnet if false
-        path = "dd/Structure/LHCb/MagnetRegion/"
-        detPieces["MagnetRegion"] = ['Magnet','BcmDown']
-        # PSZ - check why this is here
-        #if False:
-        #    for element in detPieces['MagnetRegion']:
-        #        myElement = path + element
-        #        if myElement in self._listOfGeoObjects_:
-        #            self._listOfGeoObjects_.remove([ path + element ])
-
-        # PSZ - clean me up
-        #if False:
-        #    GiGaGeo().FieldManager           = "GiGaFieldMgr/FieldMgr"
-        #    GiGaGeo().addTool( GiGaFieldMgr("FieldMgr"), name="FieldMgr" )
-        #    GiGaGeo().FieldMgr.Stepper       = "ClassicalRK4"
-        #    GiGaGeo().FieldMgr.Global        = True
-        #    GiGaGeo().FieldMgr.MagneticField = "GiGaMagFieldGlobal/LHCbField"
-        #    GiGaGeo().FieldMgr.addTool( GiGaMagFieldGlobal("LHCbField"), name="LHCbField" )
-        #    GiGaGeo().FieldMgr.LHCbField.MagneticFieldService = "MagneticFieldSvc"
-
-
-    def defineMagnetGeoField( self ):
-        # Only bother with the FIELD Geometry if simulated.
-        simDets = self.getProp('DetectorSim')['Detectors']
-        if "Magnet" in simDets or "HC" in simDets:
-            if self.getProp('UseGaussGeo'):
-                GaussGeo().FieldManager           = "GiGaFieldMgr/FieldMgr"
-                GaussGeo().addTool( GiGaFieldMgr("FieldMgr"), name="FieldMgr" )
-                GaussGeo().FieldMgr.Stepper       = "ClassicalRK4"
-                GaussGeo().FieldMgr.Global        = True
-                GaussGeo().FieldMgr.MagneticField = "GiGaMagFieldGlobal/LHCbField"
-                GaussGeo().FieldMgr.addTool( GiGaMagFieldGlobal("LHCbField"), name="LHCbField" )
-                GaussGeo().FieldMgr.LHCbField.MagneticFieldService = "MagneticFieldSvc"
-            else:
-                GiGaGeo().FieldManager           = "GiGaFieldMgr/FieldMgr"
-                GiGaGeo().addTool( GiGaFieldMgr("FieldMgr"), name="FieldMgr" )
-                GiGaGeo().FieldMgr.Stepper       = "ClassicalRK4"
-                GiGaGeo().FieldMgr.Global        = True
-                GiGaGeo().FieldMgr.MagneticField = "GiGaMagFieldGlobal/LHCbField"
-                GiGaGeo().FieldMgr.addTool( GiGaMagFieldGlobal("LHCbField"), name="LHCbField" )
-                GiGaGeo().FieldMgr.LHCbField.MagneticFieldService = "MagneticFieldSvc"
-
-        if "HC" in simDets:
-            from Configurables import MagneticFieldSvc, MultipleMagneticFieldSvc
-            # Use MultipleMagneticFieldSvc instead of default MagneticFieldSvc.
-            if self.getProp('UseGaussGeo'):
-                GaussGeo().FieldMgr.LHCbField.MagneticFieldService = "MultipleMagneticFieldSvc"
-            else:
-                GiGaGeo().FieldMgr.LHCbField.MagneticFieldService = "MultipleMagneticFieldSvc"
-            # Add LHCb dipole magnet and compensators.
-            if "Magnet" in simDets:
-              MultipleMagneticFieldSvc().MagneticFieldServices += ["MagneticFieldSvc"]
-              importOptions("$MAGNETROOT/options/UseCompensators.py")
-            # Import LSS fields.
-            importOptions("$MAGNETROOT/options/UseTripletLeft.py")
-            importOptions("$MAGNETROOT/options/UseTripletRight.py")
-            # Scale dipoles and quadrupoles.
-            scalableMagnets = ["Q1", "Q2", "Q3", "D1", "MCBX"]
-            magnets = MultipleMagneticFieldSvc().getProp("MagneticFieldServices")
-            scale =  self.getProp("BeamMomentum") / (3.5 * SystemOfUnits.TeV )
-            for magnet in magnets:
-              if any(m in magnet for m in scalableMagnets):
-                 MagneticFieldSvc(magnet).ForcedSignedCurrentScaling = scale
-                 print "Scaling", magnet, "by", scale
-
-
-
-
-#"""
-# ><<<<<<<            ><<         ><<              ><<
-# ><<    ><<           ><<       ><<               ><<
-# ><<    ><< ><<  ><<   ><<     ><<      ><<     ><>< ><    ><<
-# ><<<<<<<   ><<  ><<    ><<   ><<     ><   ><<    ><<    ><<  ><<
-# ><<        ><<  ><<     ><< ><<     ><<<<< ><<   ><<   ><<    ><<
-# ><<        ><<  ><<      ><<<<      ><           ><<    ><<  ><<
-# ><<          ><<><<       ><<         ><<<<       ><<     ><<
-#
-#"""
-
-    def definePuVetoGeo( self ):
-        pass
-
-    def configurePuVetoSim( self, slot, detHits ):
-        region = "BeforeMagnetRegion"
-        det = "PuVeto"
-        # This is still awful - PSZ
-        detextra, detextra1 = 'VeloPu', 'Velo'
-        if 'VP' not in self.getProp('DetectorSim')['Detectors']:
-            moni = GetTrackerHitsAlg(
-                'Get' + det + 'Hits' + slot,
-                MCHitsLocation = 'MC/' + det  + '/Hits',
-                CollectionName = 'VeloPuSDet/Hits',
-                Detectors = [ '/dd/Structure/LHCb/' + region + '/Velo' ]
-                )
-            detHits.Members += [ moni ]
-            self.configure_redecay_mchits(slot, 'MC/' + det  + '/Hits')
-
-    def configurePuVetoMoni( self, slot, packCheckSeq, detMoniSeq, checkHits ):
-
-        checkHits.PuVetoHits = 'MC/PuVeto/Hits'
-        # Turn off the PuVeto hits if using modified detector
-        if 'VP' not in self.getProp('DetectorSim')['Detectors']:
-            checkHits.PuVetoHits = ''
-
-        from Configurables import DataPacking__Unpack_LHCb__MCPuVetoHitPacker_
-        upPuVe = DataPacking__Unpack_LHCb__MCPuVetoHitPacker_("UnpackPuVetoHits"+slot,
-                                                              OutputName = "MC/PuVeto/HitsTest" )
-        if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-            packCheckSeq.Members += [upPuVe]
-
-            from Configurables import DataPacking__Check_LHCb__MCPuVetoHitPacker_
-            # if there's no VP do PuVeto stuff
-            if 'VP' not in self.getProp('DetectorSim')['Detectors']:
-                cPuVe = DataPacking__Check_LHCb__MCPuVetoHitPacker_("CheckPuVetoHits"+slot)
-                packCheckSeq.Members += [cPuVe]
-
-
-
-
-#"""
-##########################################################################
-##########################################################################
-##########################################################################
-##########################################################################
-##########################################################################
-#"""
-
-
-
-#"""
-#    ><<                          ><<    ><<<<<<<                  ><<
-# ><<   ><<                     ><       ><<    ><<                ><<
-#><<          ><<    ><< ><<  ><>< ><    ><<    ><<  ><< ><<       ><<
-#><<        ><<  ><<  ><<  ><<  ><<      >< ><<       ><<  ><< ><< ><<
-#><<       ><<    ><< ><<  ><<  ><<      ><<  ><<     ><<  ><<><   ><<
-# ><<   ><< ><<  ><<  ><<  ><<  ><<      ><<    ><<   ><<  ><<><   ><<
-#   ><<<<     ><<    ><<<  ><<  ><<      ><<      ><<><<<  ><< ><< ><<
-#"""
-
-
-    ##
-    ## Functions to configuration various services that are used
-    ##
-    def configureRndmEngine( self ):
-        # Random number service
-        rndmSvc = RndmGenSvc()
-        rndmGenName = self.getProp("RandomGenerator")
-        if rndmGenName == "Ranlux":
-            from Configurables import HepRndm__Engine_CLHEP__RanluxEngine_
-            engine = HepRndm__Engine_CLHEP__RanluxEngine_("RndmGenSvc.Engine")
-            engine.SetSingleton = True
-        elif rndmGenName == "MTwist" :
-            rndmSvc.Engine = "HepRndm::Engine<CLHEP::MTwistEngine>"
-            from Configurables import HepRndm__Engine_CLHEP__MTwistEngine_
-            engine = HepRndm__Engine_CLHEP__MTwistEngine_("RndmGenSvc.Engine")
-            engine.SetSingleton = True
-        else :
-            raise RuntimeError("ERROR: RandomNumber engine '%s' not recognised!" %rndmGenName)
-
-
-
-#"""
-#    ><<                          ><<    ><<                             ><<
-# ><<   ><<                     ><       ><<                             ><<
-#><<          ><<    ><< ><<  ><>< ><    ><< ><< ><<   >< ><<  ><<  ><<><>< ><
-#><<        ><<  ><<  ><<  ><<  ><<      ><<  ><<  ><< ><  ><< ><<  ><<  ><<
-#><<       ><<    ><< ><<  ><<  ><<      ><<  ><<  ><< ><   ><<><<  ><<  ><<
-# ><<   ><< ><<  ><<  ><<  ><<  ><<      ><<  ><<  ><< ><< ><< ><<  ><<  ><<
-#   ><<<<     ><<    ><<<  ><<  ><<      ><< ><<<  ><< ><<       ><<><<   ><<
-#                                                      ><<
-#"""
-
-    def configureInput(self):
-        # No events are read as input (this is not true if gen phase is
-        # switched off
-        ApplicationMgr().EvtSel = 'NONE'
-        # Transient store setup
-        EventDataSvc().ForceLeaves = True
-        # May be needed by some options
-        importOptions("$STDOPTS/PreloadUnits.opts")
-
-
-
-#"""
-#    ><<                                ><<         ><<<<<                   ><<
-# ><<   ><< ><<                         ><<         ><<   ><<   ><           ><<
-#><<        ><<         ><<        ><<< ><<  ><<    ><<    ><<        ><<< ><>< ><  ><<<<
-#><<        >< ><     ><   ><<   ><<    ><< ><<     ><<    ><< ><<  ><<      ><<   ><<
-#><<        ><<  ><< ><<<<< ><< ><<     ><><<       ><<    ><< ><< ><<       ><<     ><<<
-# ><<   ><< ><   ><< ><          ><<    ><< ><<     ><<   ><<  ><<  ><<      ><<       ><<
-#   ><<<<   ><<  ><<   ><<<<       ><<< ><<  ><<    ><<<<<     ><<    ><<<    ><<  ><< ><<
-#
-#"""
-
-    ## Raise an error if DetectorGeo/DetectorSim/DetectorMoni are not compatible
-    def fixGeoSimMoniDictionary ( self ) :
-        pass
-
-    def checkGeoSimMoniDictionary ( self ) :
-        for subdet in self.TrackingSystem + self.PIDSystem:
-            # Could do something smarter here
-            for det in self.getProp('DetectorSim')['Detectors']:
-                if self.getProp('DetectorGeo')['Detectors'].count(det) == 0 :
-                    if (det not in ['FT', 'FT-NoShield']) or ( ('FT' not in self.getProp('DetectorGeo')['Detectors']) and ('FT-NoShield' not in self.getProp('DetectorGeo')['Detectors']) ):
-                        raise RuntimeError("Simulation has been required for '%s' sub-detector but it has been removed from Geometry" %det)
-            for det in self.getProp('DetectorMoni')['Detectors']:
-                if self.getProp('DetectorSim')['Detectors'].count(det) == 0 :
-                    if (det not in ['FT', 'FT-NoShield']) or ( ('FT' not in self.getProp('DetectorSim')['Detectors']) and ('FT-NoShield' not in self.getProp('DetectorSim')['Detectors']) ):
-                        raise RuntimeError("Monitoring has been required for '%s' sub-detector but it has been removed from Simulation" %det)
-
-
-    def checkIncompatibleDetectors ( self ) :
-        for section in self._incompatibleDetectors.keys():
-            incompatList = self._incompatibleDetectors[section]
-            myList = [det for det in self.getProp("DetectorGeo")['Detectors'] if det in incompatList]
-            if len(myList) > 1:
-                raise RuntimeError ( "Incompatible detectors: %s in %s section." %(myList, section) )
-
-
-
-    ##
-    def outputName(self):
-        """
-        Build a name for the output file, based on input options.
-        Combines DatasetName, EventType, Number of events and Date
-        """
-        import time
-        outputName = self.getProp("DatasetName")
-        if self.eventType() != "":
-            if outputName != "": outputName += '-'
-            outputName += self.eventType()
-        if ( self.evtMax() > 0 ): outputName += '-' + str(self.evtMax()) + 'ev'
-        if outputName == "": outputName = 'Gauss'
-        idFile = str(time.localtime().tm_year)
-        if time.localtime().tm_mon < 10:
-            idFile += '0'
-        idFile += str(time.localtime().tm_mon)
-        if time.localtime().tm_mday < 10:
-            idFile += '0'
-        idFile += str(time.localtime().tm_mday)
-        outputName += '-' + idFile
-        return outputName
-
-
-#"""
-# ><<<<<                  ><<   ><<<<<<<                                        ><<
-# ><<   ><<             ><      ><<    ><<                          ><          ><<
-# ><<    ><<   ><<    ><>< ><   ><<    ><<   ><<    >< ><<< ><<<<       ><<<< ><>< ><
-# ><<    ><< ><   ><<   ><<     ><<<<<<<   ><   ><<  ><<   ><<     ><< ><<      ><<
-# ><<    ><<><<<<< ><<  ><<     ><<       ><<<<< ><< ><<     ><<<  ><<   ><<<   ><<
-# ><<   ><< ><          ><<     ><<       ><         ><<       ><< ><<     ><<  ><<
-# ><<<<<      ><<<<     ><<     ><<         ><<<<   ><<<   ><< ><< ><< ><< ><<   ><<
-#"""
-
-
-    ##
-
-#"""
-#
-# ><<<<<<<                                   ><< <<                        ><<                            ><<
-# ><<    ><<                               ><<    ><<  ><               ><<   ><<                       ><
-# ><<    ><< >< ><<<   ><<     >< ><<       ><<           ><<< ><< ><< ><<          ><<     ><< ><<   ><>< ><
-# ><<<<<<<    ><<    ><<  ><<  ><  ><<        ><<     ><<  ><<  ><  ><<><<        ><<  ><<   ><<  ><<   ><<
-# ><<         ><<   ><<    ><< ><   ><<          ><<  ><<  ><<  ><  ><<><<       ><<    ><<  ><<  ><<   ><<
-# ><<         ><<    ><<  ><<  ><< ><<     ><<    ><< ><<  ><<  ><  ><< ><<   ><< ><<  ><<   ><<  ><<   ><<
-# ><<        ><<<      ><<     ><<           ><< <<   ><< ><<<  ><  ><<   ><<<<     ><<     ><<<  ><<   ><<
-#                              ><<
-#
-#"""
-
-    def propagateSimConf( self ):
-        # Propagate properties to SimConf
-        SimConf().setProp("Writer","GaussTape")
-        self.setOtherProps( SimConf(), ["SpilloverPaths","EnablePack","Phases","DataType"] )
-        # if we have post-sim filters, we only want to write if the filter is passed
-        if self.getProp("PostSimFilters") :
-            OutputStream("GaussTape").RequireAlgs.append( "PostSimFilterSeq" )
-
-
-        # CRJ : Propagate detector list to SimConf. Probably could be simplified a bit
-        #       by sychronising the options in Gauss() and SimConf()
-        detlist = []
-        if 'Velo'    in self.getProp('DetectorSim')['Detectors'] : detlist += ['Velo']
-        if 'PuVeto'  in self.getProp('DetectorSim')['Detectors'] : detlist += ['PuVeto']
-        if 'TT'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['TT']
-        if 'IT'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['IT']
-        if 'OT'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['OT']
-        if [det for det in ['Rich1', 'Rich2', 'Rich1Pmt', 'Rich2Pmt'] if det in self.getProp('DetectorSim')['Detectors']] :
-            detlist += ['Rich']
-        if 'Muon'    in self.getProp('DetectorSim')['Detectors'] : detlist += ['Muon']
-        if 'Spd'     in self.getProp('DetectorSim')['Detectors'] : detlist += ['Spd']
-        if 'Prs'     in self.getProp('DetectorSim')['Detectors'] : detlist += ['Prs']
-        if 'Ecal'    in self.getProp('DetectorSim')['Detectors'] : detlist += ['Ecal']
-        if 'Hcal'    in self.getProp('DetectorSim')['Detectors'] : detlist += ['Hcal']
-        if 'HC'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['HC']
-        # GC - 20160323 Bmc and Bls Off for now
-        ## if 'Bcm'     in self.getProp('DetectorSim')['Detectors'] : detlist += ['Bcm']
-        ## if 'Bls'     in self.getProp('DetectorSim')['Detectors'] : detlist += ['Bls']
-        # PSZ - add upgrade detectors here
-        if 'VP'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['VP']
-        if 'UT'      in self.getProp('DetectorSim')['Detectors'] : detlist += ['UT']
-        if ('FT' in self.getProp('DetectorSim')['Detectors']) or ('FT-NoShield' in self.getProp('DetectorSim')['Detectors']) :
-            detlist += ['FT']
-        if 'SL'    in self.getProp('DetectorSim')['Detectors'] : detlist += ['SL']
-        # if Skip4 then dont propagate the detector list
-        if "GenToMCTree" in self.getProp("Phases"):
-            detlist = []
-
-        SimConf().setProp("Detectors",detlist)
-
-
-        # Don't want SIM data unpacking enabled in DoD service
-        SimConf().EnableUnpack = False
-
-
-#"""
-#      ><<                                                              ><<                     ><<
-#   ><<   ><<                                  ><                       ><<        ><           ><<
-#  ><<        >< ><<<   ><<     ><<<<  ><<<<      ><< ><<      ><<      ><<            ><<<<  ><>< ><
-#  ><<         ><<    ><<  ><< ><<    ><<     ><<  ><<  ><<  ><<  ><<   ><<       ><< ><<       ><<
-#  ><<         ><<   ><<    ><<  ><<<   ><<<  ><<  ><<  ><< ><<   ><<   ><<       ><<   ><<<    ><<
-#   ><<   ><<  ><<    ><<  ><<     ><<    ><< ><<  ><<  ><<  ><<  ><<   ><<       ><<     ><<   ><<
-#     ><<<<   ><<<      ><<    ><< ><<><< ><< ><< ><<<  ><<      ><<    ><<<<<<<< ><< ><< ><<    ><<
-#                                                            ><<
-#"""
-    def defineCrossingList( self ):
-        crossingList = [ '' ]
-        spillOverList = self.getProp("SpilloverPaths")
-        while '' in spillOverList :
-            spillOverList.remove('')
-        crossingList += spillOverList
-        return crossingList
-
-
-#"""
-#
-#  ><< ><<                                          ><<<<<<<
-#  ><    ><<                                        ><<    ><<
-#  ><     ><<    ><<        ><<     ><<< ><< ><<    ><<    ><<    ><<     >< ><<<    ><<     ><<< ><< ><<   ><<<<
-#  ><<< ><     ><   ><<   ><<  ><<   ><<  ><  ><<   ><<<<<<<    ><<  ><<   ><<     ><<  ><<   ><<  ><  ><< ><<
-#  ><     ><< ><<<<< ><< ><<   ><<   ><<  ><  ><<   ><<        ><<   ><<   ><<    ><<   ><<   ><<  ><  ><<   ><<<
-#  ><      >< ><         ><<   ><<   ><<  ><  ><<   ><<        ><<   ><<   ><<    ><<   ><<   ><<  ><  ><<     ><<
-#  ><<<< ><<    ><<<<      ><< ><<< ><<<  ><  ><<   ><<          ><< ><<< ><<<      ><< ><<< ><<<  ><  ><< ><< ><<
-#"""
-    #--Set the energy of the beam,
-    #--the half effective crossing angle (in LHCb coordinate system),
-    #--beta* and emittance
-    #--and configure the colliding beam tool for all type of events in
-    #--pp collisions.
-    def setBeamParameters( self, CrossingSlots, genInit):
-
-        from Configurables import ( MinimumBias , FixedNInteractions , HijingProduction )
-        from Configurables import ( Special , Pythia8Production )
-        from Configurables import ( Generation )
-
-        #
-        beamMom                        = self.getProp("BeamMomentum")
-        xAngle                         = self.getProp("BeamHCrossingAngle")
-        yAngle                         = self.getProp("BeamVCrossingAngle")
-        xAngleBeamLine, yAngleBeamLine = self.getProp("BeamLineAngles")
-        emittance                      = self.getProp("BeamEmittance")
-        betaStar                       = self.getProp("BeamBetaStar")
-        lumiPerBunch                   = self.getProp("Luminosity")
-        totCrossSection                = self.getProp("TotalCrossSection")
-        meanX, meanY, meanZ            = self.getProp("InteractionPosition")
-        sigmaS                         = self.getProp("BunchRMS")
-        b2Mom                          = self.getProp("B2Momentum")
-        B1Particle                     = self.getProp("B1Particle")
-        B2Particle                     = self.getProp("B2Particle")
-
-        # Give beam parameters to GenInit algorithm
-        genInit.CreateBeam              = True
-        genInit.BeamEnergy              = beamMom
-        genInit.HorizontalCrossingAngle = xAngle
-        genInit.VerticalCrossingAngle   = yAngle
-        genInit.NormalizedEmittance     = emittance
-        genInit.BetaStar                = betaStar
-        genInit.HorizontalBeamlineAngle = xAngleBeamLine
-        genInit.VerticalBeamlineAngle   = yAngleBeamLine
-        genInit.Luminosity              = lumiPerBunch
-        genInit.TotalCrossSection       = totCrossSection
-        genInit.XLuminousRegion         = meanX
-        genInit.YLuminousRegion         = meanY
-        genInit.ZLuminousRegion         = meanZ
-        genInit.BunchLengthRMS          = sigmaS
-
-        gen_t0 = Generation("Generation")
-
-        # the following is for beam gas events, the values are just to give the
-        # nominal beam conditions in the data but 1 single interaction is
-        # forced selecting the appropriate pileup tool in the eventtype
-        gen_t0.addTool(FixedNInteractions,name="FixedNInteractions")
-        gen_t0.FixedNInteractions.NInteractions = 1
-
-        ## handle the information for HI generation (EPOS or HIJING)
-        ## Is it a fixed target generation ?
-        isFixedTarget = ( ( beamMom == 0. ) or (b2Mom == 0. ) )
-
-        ## pass collision energy to Hijing (must be in CMS and in GeV)
-        if ( isFixedTarget ):
-            if ( b2Mom == 0 ):
-                pInGeV   = beamMom*SystemOfUnits.GeV/SystemOfUnits.TeV
-            else:
-                pInGeV   = b2Mom*SystemOfUnits.GeV/SystemOfUnits.TeV
-        else:
-            p1InGeV = beamMom*SystemOfUnits.GeV/SystemOfUnits.TeV
-            p2InGeV = b2Mom*SystemOfUnits.GeV/SystemOfUnits.TeV
-            ## beam energies in CMS for pPb collision system
-	    import math
-	    massProton = 0.938272046 #in GeV
-	    e1InGeV = math.sqrt( p1InGeV**2 + massProton**2 )
-	    e2InGeV = math.sqrt( p2InGeV**2 + massProton**2 )
-	    pInGeV = math.sqrt( ( e1InGeV + e2InGeV )**2 - ( p1InGeV + p2InGeV )**2 )
-
-        txtP = "hijinginit efrm "+str(pInGeV)
-        gen_t0.addTool(MinimumBias,name="MinimumBias")
-        gen_t0.MinimumBias.addTool(HijingProduction,name="HijingProduction")
-        gen_t0.MinimumBias.HijingProduction.Commands += [ txtP ]    
-
-        ## Setup EPOS particle type
-        gen_t0.MinimumBias.addTool(CRMCProduction,name="CRMCProduction")
-        if ( B1Particle not in self.__ion_pdg_id__.keys() ):
-            raise RuntimeError( "Unknown particle type: %s"  % B1Particle )
-        if ( B2Particle not in self.__ion_pdg_id__.keys() ):
-            raise RuntimeError( "Unknown particle type: %s"  % B2Particle )
-        gen_t0.MinimumBias.CRMCProduction.ProjectileID = self.__ion_pdg_id__[ B1Particle ]
-        gen_t0.MinimumBias.CRMCProduction.TargetID = self.__ion_pdg_id__[ B2Particle ]
-        gen_t0.MinimumBias.CRMCProduction.ProjectileMomentum = beamMom / SystemOfUnits.GeV
-        gen_t0.MinimumBias.CRMCProduction.TargetMomentum = b2Mom / SystemOfUnits.GeV
-
-        ## Setup HIJING particle type
-        if ( B1Particle != 'p' ):
-            Zproj = str( self.__ion_pdg_id__[ B1Particle ] )[ 4:6 ]
-            Aproj = str( self.__ion_pdg_id__[ B1Particle ] )[ 6:9 ]
-            textOptionHijing = "hijinginit izp %s," % Zproj
-            textOptionHijing+= "hijinginit iap %s," % Aproj
-            textOptionHijing+= "hijinginit proj A,"
-        else:
-            textOptionHijing = "hijinginit izp 1,"
-            textOptionHijing+= "hijinginit iap 1,"
-            textOptionHijing+= "hijinginit proj P,"
-        if ( B2Particle != 'p' ):
-            Ztarg = str( self.__ion_pdg_id__[ B2Particle ] )[ 4:6 ]
-            Atarg = str( self.__ion_pdg_id__[ B2Particle ] )[ 6:9 ]
-            textOptionHijing+= "hijinginit izt %s," % Ztarg
-            textOptionHijing+= "hijinginit iat %s," % Atarg
-            textOptionHijing+= "hijinginit targ A,"
-        else:
-            textOptionHijing+= "hijinginit izt 1,"
-            textOptionHijing+= "hijinginit iat 1,"
-            textOptionHijing+= "hijinginit targ P,"
-
-        if isFixedTarget:
-            textOptionHijing+= "hijinginit frame LAB,"
-            if ( beamMom == 0 ):
-                textOptionHijing+= "hijinginit beam2"
-            else:
-                textOptionHijing+= "hijinginit beam1"
-        else:
-            textOptionHijing+= "hijinginit frame CMS"
-        gen_t0.MinimumBias.HijingProduction.Commands += textOptionHijing.split(",")
-
-    #--For beam gas events (with hijing) only the energy of the beams is set
-
-    #--Set location for histogram particle guns based on beam energy
-        from Configurables import ParticleGun, MomentumSpectrum
-        pgun = ParticleGun("ParticleGun")
-        pgun.addTool( MomentumSpectrum , name = "MomentumSpectrum" )
-        txtPInGeV = str(pInGeV).split(".")[0]
-        hFileName = pgun.MomentumSpectrum.getProp("InputFile")
-        hFileName = hFileName.replace("Ebeam4000GeV","Ebeam"+txtPInGeV+"GeV")
-        pgun.MomentumSpectrum.InputFile = hFileName
-        print hFileName
-
-    ## end of functions to set beam paramters and propagate them
-    ##########################################################################
-
-
-
-#"""
-#      ><<                             ><<       ><<<<
-#   ><<   ><<                        ><        ><    ><<
-#  ><<           ><<     ><< ><<   ><>< ><    ><<            ><<     ><< ><<
-#  ><<         ><<  ><<   ><<  ><<   ><<      ><<          ><   ><<   ><<  ><<
-#  ><<        ><<    ><<  ><<  ><<   ><<      ><<   ><<<< ><<<<< ><<  ><<  ><<
-#   ><<   ><<  ><<  ><<   ><<  ><<   ><<       ><<    ><  ><          ><<  ><<
-#     ><<<<      ><<     ><<<  ><<   ><<        ><<<<<      ><<<<    ><<<  ><<
-#
-#"""
-    def configureGen( self, SpillOverSlots ):
-        """
-        Set up the generator execution sequence and its sub-phases
-        """
-
-##         if "Gen" not in self.getProp("MainSequence") :
-##             log.warning("No generator phase. Need input file")
-##             return
-
-        do_redecay = self.Redecay['active']
-        if self.evtMax() <= 0:
-            raise RuntimeError( "Generating events but selected '%s' events. Use LHCbApp().EvtMax " %self.evtMax() )
-
-        gaussGeneratorSeq = GaudiSequencer( "Generator", IgnoreFilterPassed = True )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussGeneratorSeq ]
-
-        from Configurables import ( EvtGenDecay )
+        from Configurables import EvtGenDecay
         EvtGenDecay().DecayFile = "$DECFILESROOT/dkfiles/DECAY.DEC"
 
-
-        from Configurables import ( GenInit, Generation, MaskParticles )
-        for slot in SpillOverSlots:
-            genSequence = GaudiSequencer("GeneratorSlot"+self.slotName(slot)+"Seq" )
-            gaussGeneratorSeq.Members += [ genSequence ]
-
-            TESNode = "/Event/"+self.slot_(slot)
-            genInit = GenInit("GaussGen"+slot,
-                              MCHeader = TESNode+"Gen/Header")
-            if self.isGaussMP():
-                genInit.EvtCounter = "EvtCounter"
-
-            FSRNode = "/FileRecords/"+self.slot_(slot)
-
-            if slot != '':
-                genInitT0 = GenInit("GaussGen")
-                if genInitT0.isPropertySet("RunNumber"):
-                    genInit.RunNumber = genInitT0.RunNumber
-                if genInitT0.isPropertySet("FirstEventNumber"):
-                    genInit.FirstEventNumber = genInitT0.FirstEventNumber
-
-
-            genProc = 0
-            genType = self.getProp("Production").upper()
-            from Configurables import ParticleGun, MIBackground
-            KnownGenTypes = ['PHYS','PGUN','MIB']
-            if genType not in KnownGenTypes:
-                raise RuntimeError("Unknown Generation type '%s'"%genType)
-            if genType == 'PHYS':
-                genProc = Generation("Generation"+slot)
-            elif genType == 'PGUN':
-                genProc = ParticleGun("ParticleGun"+slot)
-            else:
-                genProc = MIBackground("MIBackground"+slot)
-
-            genProc.GenHeaderLocation = TESNode+"Gen/Header"
-            genProc.HepMCEventLocation = TESNode+"Gen/HepMCEvents"
-            genProc.GenCollisionLocation = TESNode+"Gen/Collisions"
-
-            if "GenFSRLocation" in genProc.properties():
-                if not genProc.isPropertySet("GenFSRLocation"):
-                    genProc.GenFSRLocation = FSRNode+"GenFSR"
-
-            if slot != '':
-                genProc.PileUpTool = 'FixedLuminosityForSpillOver'
-
-            if do_redecay:
-                # This filter checks if a new event needs to be generated,
-                # if not rest of the sequencer is not run.
-                gaussrdfilter = GaussRedecayCtrFilter('RegisterNewEvent{}'.format(slot))
-                gaussrdfilter.RegisterNewEvent = True
-                genSequence.Members += [ genInit, gaussrdfilter, genProc ]
-            else:
-                genSequence.Members += [ genInit , genProc ]
-            # When HC simulation is switched on the very forward protons must be
-            # removed from the HepMC record since they cause showers in it
-            if 'HC' in self.getProp('DetectorSim')['Detectors']:
-                genMask = MaskParticles("MaskDiffractiveProton"+slot,
-                                        HepMCEventLocation = TESNode+"Gen/HepMCEvents")
-                genSequence.Members += [genMask]
-
-            if slot == '' and do_redecay:
-                genSequence.Members += [ GaussRedecaySorter() ]
-
-
-    ## end of Gen configuration
-    ##########################################################################
-
-
-#"""
-#     ><<                             ><<    ><<<<<<<
-#  ><<   ><<                        ><       ><<    ><< ><<
-# ><<           ><<     ><< ><<   ><>< ><    ><<    ><< ><<         ><<      ><<<<     ><<      ><<<<
-# ><<         ><<  ><<   ><<  ><<   ><<      ><<<<<<<   >< ><     ><<  ><<  ><<      ><   ><<  ><<
-# ><<        ><<    ><<  ><<  ><<   ><<      ><<        ><<  ><< ><<   ><<    ><<<  ><<<<< ><<   ><<<
-#  ><<   ><<  ><<  ><<   ><<  ><<   ><<      ><<        ><   ><< ><<   ><<      ><< ><             ><<
-#    ><<<<      ><<     ><<<  ><<   ><<      ><<        ><<  ><<   ><< ><<< ><< ><<   ><<<<    ><< ><<
-#"""
-    def configurePhases( self, SpillOverSlots  ):
-        """
-        Set up the top level sequence and its phases
-        """
-
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        ApplicationMgr().TopAlg = [ gaussSeq ]
-##         mainSeq = self.getProp("MainSequence")
-##         if len( mainSeq ) == 0:
-##             mainSeq = self.DefaultSequence
-
-##         mainSeq = map(lambda ph: ph.capitalize(), mainSeq)
-##         self.setProp("MainSequence",mainSeq)
-##         for phase in mainSeq:
-##             raise RuntimeError("Unknown phase '%s'"%phase)
-
-        # if the filter sequence is non-empty, add it here
-        if self.getProp("PostSimFilters") :
-            filterSeq = GaudiSequencer("PostSimFilterSeq")
-            if not self.getProp("SplitSim"):
-                ApplicationMgr().TopAlg += [ filterSeq ]
-            self.configurePostSimFilters( filterSeq )
-
-
-        ### Check for configuration consistency
-        if ( ( "GenToMCTree" in self.getProp("Phases") ) and ( "Simulation" in self.getProp("Phases") ) ):
-            raise RuntimeError("GenToMCTree and Simulation cannot be part of Phases simultaneously")
-
-        self.configureGen( SpillOverSlots )
-        if "GenToMCTree" in self.getProp("Phases"):
-            self.configureSkipGeant4( SpillOverSlots )
-
-        # Redecay and splitted simulation both hack the simulation sequence
-        # and need a specialised configuration and so does their combination,
-        # which are intertwined such that a combination is difficult
-        if self.Redecay['active'] and self.getProp("SplitSim"):
-            self.configureRedecaySplitSim( SpillOverSlots )
-            self.configureRedecay(SpillOverSlots)
-        elif self.Redecay['active'] and not self.getProp("SplitSim"):
-            self.configureRedecaySim( SpillOverSlots )
-            self.configureRedecay(SpillOverSlots)
-        elif self.getProp("SplitSim"):
-            self.configureSplitSim( SpillOverSlots )
-        else:
-            self.configureSim( SpillOverSlots )
-        self.configureMoni( SpillOverSlots ) #(expert or default)
-    ## end of phase configuration
-    ##########################################################################
-
-#"""
-# ><<<<<<<<  ><  ><    ><
-# ><<<<<<<<  ><  ><    ><
-# ><<            ><  ><><><     ><<     >< ><<<   ><<<
-# ><<<<<     ><  ><    ><     ><   ><<   ><<     ><<
-# ><<        ><  ><    ><    ><<<<< ><<  ><<       ><<<
-# ><<        ><  ><    ><    ><          ><<         ><<
-# ><<        ><  ><<<  ><<     ><<<<    ><<<      <<><<
-#
-#"""
-
-    def configurePostSimFilters(self, filterSeq):
-        # essentially just a list of ifs for the different filters...
-        for filter in self.PostSimFilters:
-            if filter in self.KnownPostSimFilters:
-                # check for the name of the know filters and add them one by one
-                if filter == "ConversionFilter":
-                    from Configurables import ConversionFilter
-                    filterSeq.Members.append( ConversionFilter("ConversionFilter") )
-            else:
-                raise RuntimeError("Unknown Filter '%s'"%filter)
-
-
-#"""
-# ><<<<<                    ><<       ><<<<                 ><<                       ><<
-# ><<   ><<               ><        ><<    ><<              ><<                       ><<
-# ><<    ><<    ><<     ><>< ><   ><<        ><< ><<  ><< ><>< >< >< ><<   ><<  ><< ><>< ><
-# ><<    ><<  ><   ><<    ><<     ><<        ><< ><<  ><<   ><<   ><  ><<  ><<  ><<   ><<
-# ><<    ><< ><<<<< ><<   ><<     ><<        ><< ><<  ><<   ><<   ><   ><< ><<  ><<   ><<
-# ><<   ><<  ><           ><<       ><<     ><<  ><<  ><<   ><<   ><< ><<  ><<  ><<   ><<
-# ><<<<<       ><<<<      ><<         ><<<<        ><<><<    ><<  ><<        ><<><<    ><<
-#                                                                 ><<
-#"""
-
-    def defineOutput( self, SpillOverSlots ):
-        """
-        Set up output stream according to phase processed, the spill-over slots and the type of output
-        """
-
-        #
-        knownOptions = ['NONE','GEN','XGEN','RGEN','SIM','XSIM']
-        output = self.getProp("OutputType").upper()
-        if output == 'NONE':
-            log.warning("No event data output produced")
-            return
-
-        simWriter = SimConf().writer()
-
-        # define default file extensions depending on the phase that has been run
-        fileDefaultExtension = ".gen"
-        fileAllowedExtension = [fileDefaultExtension]
-        if "GenToMCTree" in self.getProp("Phases"):
-            fileDefaultExtension = ".xgen"
-            fileAllowedExtension = [fileDefaultExtension, ".rgen"]
-        elif "Simulation" in self.getProp("Phases"):
-            fileDefaultExtension = ".sim"
-            fileAllowedExtension = [fileDefaultExtension, ".xsim"]
-
-        # choose the file extension from the one selected compatibly with the phase run
-        if output not in knownOptions:
-            print "WARNING: OutputType not supported. Use default for chosen phases : %s" %(fileDefaultExtension)
-        fileExtension = "." + output.lower()
-        if fileExtension not in fileAllowedExtension:
-            fileExtension = fileDefaultExtension
-            print "WARNING: OutputType not supported for this phase. Use default : %s" %(fileExtension)
-
-        # set saving or not of HepMC depending on chosen file extension
-        if SimConf().isPropertySet( "SaveHepMC" ):
-            print "WARNING: SimConf().SaveHepMC will be ignored. Value set by Gauss()"
-        saveHepMC = False
-        if fileExtension in ['.gen','.xgen','.xsim']:
-            saveHepMC = True
-        SimConf().setProp("SaveHepMC", saveHepMC )
-
-        outputFile=""
-        from GaudiConf import IOHelper
-        if simWriter.isPropertySet( "Output" ):
-            outputFile=IOHelper().undressFile(simWriter.getProp("Output"))
-        else:
-            outputFile=self.outputName() + fileExtension
-
-        # Merge genFSRs
-        if self.getProp("WriteFSR"):
-            seqGenFSR = GaudiSequencer("GenFSRSeq")
-            ApplicationMgr().TopAlg += [ seqGenFSR ]
-
-            if self.getProp("MergeGenFSR"):
-                seqGenFSR.Members += [ "GenFSRMerge" ]
-
-        IOHelper().outStream( outputFile, simWriter, self.getProp("WriteFSR") )
-
-        simWriter.RequireAlgs.append( 'GaussSequencer' )
-        if not FileCatalog().isPropertySet("Catalogs"):
-            FileCatalog().Catalogs = [ "xmlcatalog_file:NewCatalog.xml" ]
-
-#"""
-#
-# ><<<<<                    ><<   ><<       ><<                            ><<
-# ><<   ><<               ><      >< ><<   ><<<                       ><   ><<
-# ><<    ><<    ><<     ><>< ><   ><< ><< > ><<    ><<     ><< ><<       ><>< ><    ><<     >< ><<<  ><<<<
-# ><<    ><<  ><   ><<    ><<     ><<  ><<  ><<  ><<  ><<   ><<  ><< ><<   ><<    ><<  ><<   ><<    ><<
-# ><<    ><< ><<<<< ><<   ><<     ><<   ><  ><< ><<    ><<  ><<  ><< ><<   ><<   ><<    ><<  ><<      ><<<
-# ><<   ><<  ><           ><<     ><<       ><<  ><<  ><<   ><<  ><< ><<   ><<    ><<  ><<   ><<        ><<
-# ><<<<<       ><<<<      ><<     ><<       ><<    ><<     ><<<  ><< ><<    ><<     ><<     ><<<    ><< ><<
-#
-#"""
-
-    def defineMonitors( self ):
-
-        from Configurables import ApplicationMgr, AuditorSvc, SequencerTimerTool
-        ApplicationMgr().ExtSvc += [ 'AuditorSvc' ]
-        ApplicationMgr().AuditAlgorithms = True
-        AuditorSvc().Auditors += [ 'TimingAuditor' ]
-        #SequencerTimerTool().OutputLevel = WARNING
-
-        # Set printout level and longer algorithm" identifier in printout
-        MessageSvc().OutputLevel = INFO
-        #ToolSvc.EvtGenTool.OutputLevel = 4 is it still necessary to reduce print?
-        MessageSvc().setWarning.append( 'XmlGenericCnv' )
-        if not MessageSvc().isPropertySet("Format"):
-            MessageSvc().Format = '% F%24W%S%7W%R%T %0W%M'
-
-
-#"""
-#   ><< <<                                        ><<     ><<               ><<
-# ><<    ><<                                      ><<     ><<  ><           ><<
-#  ><<          ><<     ><<     ><<    ><<        ><<     ><<      ><<<<  ><>< ><    ><<      ><<<<
-#    ><<      ><<  ><<   ><<   ><<   ><   ><<     ><<<<<< ><< ><< ><<       ><<    ><<  ><<  ><<
-#       ><<  ><<   ><<    ><< ><<   ><<<<< ><<    ><<     ><< ><<   ><<<    ><<   ><<    ><<   ><<<
-# ><<    ><< ><<   ><<     ><><<    ><            ><<     ><< ><<     ><<   ><<    ><<  ><<      ><<
-#   ><< <<     ><< ><<<     ><<       ><<<<       ><<     ><< ><< ><< ><<    ><<     ><<     ><< ><<
-#"""
-
-    def saveHistos( self ):
-        """
-        Set up histogram service and file name unless done in job
-        """
-
-        # ROOT persistency for histograms
-        importOptions('$STDOPTS/RootHist.opts')
-        from Configurables import RootHistCnv__PersSvc
-        RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True
-
-        histOpt = self.getProp("Histograms").upper()
-        if histOpt not in self.KnownHistOptions:
-            raise RuntimeError("Unknown Histograms option '%s'"%histOpt)
-            # HistogramPersistency needed to read in histogram for calorimeter
-            # so do not set ApplicationMgr().HistogramPersistency = "NONE"
-            return
-
-        # If not saving histograms do not set the name of the file
-        if ( histOpt == 'NONE') :
-            log.warning("No histograms produced")
-            return
-
-        # Use a default histogram file name if not already set
-        if not HistogramPersistencySvc().isPropertySet( "OutputFile" ):
-            histosName = self.getProp("DatasetName")
-            histosName = self.outputName() + '-histos.root'
-            HistogramPersistencySvc().OutputFile = histosName
-
-
-
-
-
-
-
-
-#"""
-#GEO
-#Geo
-#
-#     ><<<<
-#   ><    ><<
-#  ><<            ><<        ><<
-#  ><<          ><   ><<   ><<  ><<
-#  ><<   ><<<< ><<<<< ><< ><<    ><<
-#   ><<    ><  ><          ><<  ><<
-#    ><<<<<      ><<<<       ><<
-#
-#"""
-
-
-
-    def defineGeoBasePieces( self, basePieces ):
-        #basePieces['BeforeMagnetRegion']=['Velo2Rich1']
-        basePieces['BeforeUpstreamRegion']  = []
-        basePieces['UpstreamRegion']        = []
-        basePieces['BeforeMagnetRegion']    = []
-        basePieces['MagnetRegion']          = []
-        basePieces['AfterMagnetRegion']     = []
-        basePieces['DownstreamRegion']      = []
-        basePieces['AfterDownstreamRegion'] = []
-
-        #basePieces['UpstreamRegion']=[]
-        #basePieces['BeforeMagnetRegion']=[]
-        #basePieces['MagnetRegion']=['PipeInMagnet','PipeSupportsInMagnet']
-        #basePieces['AfterMagnetRegion']=['PipeAfterT','PipeSupportsAfterMagnet']
-        #basePieces['DownstreamRegion']=['PipeDownstream','PipeSupportsDownstream','PipeBakeoutDownstream']
-
-    # This is where everything is parsed into geo items
-    def defineStreamItemsGeo( self, basePieces, detPieces ):
-        for region in basePieces.keys():
-            path = "/dd/Structure/LHCb/"+region+"/"
-            if len(detPieces[region])==0 : continue
-            # This should preserve order
-            for element in basePieces[region] + detPieces[region]:
-                myStreamItem = path + element
-                if myStreamItem not in self._listOfGeoObjects_:
-                    self._listOfGeoObjects_.append(myStreamItem)
-            #for element in detPieces[region]:
-            #    myStreamItem = path + element
-            #    if myStreamItem not in self._listOfGeoObjects_:
-            #        self._listOfGeoObjects_.append(myStreamItem)
-
-
-
-#"""
-#  ><<<<<                    ><<       ><<<<
-#  ><<   ><<               ><        ><    ><<
-#  ><<    ><<    ><<     ><>< ><    ><<            ><<        ><<
-#  ><<    ><<  ><   ><<    ><<      ><<          ><   ><<   ><<  ><<
-#  ><<    ><< ><<<<< ><<   ><<      ><<   ><<<< ><<<<< ><< ><<    ><<
-#  ><<   ><<  ><           ><<       ><<    ><  ><          ><<  ><<
-#  ><<<<<       ><<<<      ><<        ><<<<<      ><<<<       ><<
-#
-#"""
-
-    def defineDetectorGeo( self, basePieces, detPieces, det ):
-        import string
-        lDet = det.lower()
-        if lDet not in self.__knownDetectors__:
-            log.warning("Geo Detector not known : %s" %(det))
-
-        if lDet == "magnet":
-            self.defineMagnetGeo( basePieces, detPieces )
-        elif lDet == "puveto":
-            self.definePuVetoGeo( )
-        elif lDet == "velo":
-            self.defineVeloGeo( basePieces, detPieces )
-        elif lDet == "tt":
-            self.defineTTGeo( detPieces )
-        elif lDet == "it":
-            self.defineITGeo( detPieces )
-        elif lDet == "ot":
-            self.defineOTGeo( detPieces )
-        elif lDet == "muon":
-            self.defineMuonGeo( detPieces )
-        elif lDet == "rich1":
-            self.defineRich1GeoDet( detPieces )
-        elif lDet == "rich2":
-            self.defineRich2GeoDet( detPieces )
-        elif lDet == "spd":
-            self.defineSpdGeo( detPieces )
-        elif lDet == "prs":
-            self.definePrsGeo( detPieces )
-        elif lDet == "ecal":
-            self.defineEcalGeo( detPieces )
-        elif lDet == "hcal":
-            self.defineHcalGeo( detPieces )
-        elif lDet == "hc":
-            self.defineHCGeo(detPieces)
-        # GC - 20160323 Bcm and Bls off for now
-        ## elif lDet == "bcm":
-        ##     self.defineBcmGeo(detPieces)
-        ## elif lDet == "bls":
-        ##     self.defineBlsGeo(detPieces)
-        # Upgrade detectors below
-        elif lDet == "vp":
-            self.defineVPGeo( detPieces )
-        elif lDet == "torch":
-            self.defineTorchGeo()
-        elif (lDet == "ft") or (lDet == "ft-noshield"):
-            self.defineFTGeo( lDet, detPieces )
-        elif lDet == "rich1pmt":
-            self.defineRich1MaPmtGeoDet( detPieces )
-        elif lDet == "rich2pmt":
-            self.defineRich2MaPmtGeoDet( detPieces )
-        elif lDet == "ut":
-            self.defineUTGeo( detPieces )
-        elif lDet == "sl":
-            self.defineSLGeo( detPieces )
-        else:
-            log.warning("Geo Detector not known : %s" %(det))
-
-    def defineDetectorGeoStream ( self, geoCnvSvc, det ):
-        import string
-        lDet = det.lower()
-        if lDet not in self.__knownDetectors__:
-            log.warning("Geo Stream Detector not known : %s" %(det))
-
-        if lDet == "rich1":
-            self.defineRich1GeoStream()
-        elif lDet == "rich2":
-            self.defineRich2GeoStream()
-        elif lDet == "rich1pmt":
-            self.defineRich1MaPmtGeoStream( geoCnvSvc )
-        elif lDet == "rich2pmt":
-            self.defineRich2MaPmtGeoStream( geoCnvSvc )
-        elif lDet == "magnet":
-            self.defineMagnetGeoField()
-
-
-
-    def defineGDMLGeoStream ( self, geoCnvSvc ):
-        if self.getProp("ReplaceWithGDML"):
-            gdmlOpt = self.getProp("ReplaceWithGDML")
-            if gdmlOpt[0]["volsToReplace"]:
-                for gdmlDict in self.getProp("ReplaceWithGDML"):
-                    self.defineGDMLGeo ( geoCnvSvc, gdmlDict )
-
-
-
-
-    def defineGeo( self ):
-        # Define the simulated geometry
-        geo = GiGaInputStream( "Geo",
-                               ExecuteOnce = True,
-                               ConversionSvcName = "GiGaGeo",
-                               DataProviderSvcName  = "DetectorDataSvc" )
-
-        gaussSimulationSeq = GaudiSequencer("Simulation")
-
-        if not self.getProp('UseGaussGeo'):
-            gaussSimulationSeq.Members += [ geo ]
-
-        # Detector geometry to simulate
-        detPieces = {'BeforeUpstreamRegion':[], 'UpstreamRegion':[],
-                     'BeforeMagnetRegion':[], 'MagnetRegion':[], 'AfterMagnetRegion':[],
-                     'DownstreamRegion':[], 'AfterDownstreamRegion':[]}
-        #detPieces = {'BeforeMagnetRegion':[],'AfterMagnetRegion':[],'DownstreamRegion':[],'MagnetRegion':[]}
-        basePieces = {}
-
-        # Must be first!
-        # This used to list all the beampipe detector elements
-        # which are not "inside" another detector.
-        # i.e. top-level detector elements
-        # DDDB structure may change in future
-        self.defineGeoBasePieces( basePieces )
-
-        # Define beampipe
-        self.validateBeamPipeSwitch ( self.getProp("BeamPipe") )
-        if ("BeamPipeOn" == self.getProp("BeamPipe")):
-            # BeamPipe on - add BP elements
-            self.defineBeamPipeGeo ( basePieces, detPieces )
-
-        # Set geometry conversion service
-        geoCnvSvc = None
-        if self.getProp('UseGaussGeo'):
-            geoCnvSvc = GaussGeo()
-        else:
-            geoCnvSvc = GiGaGeo()
-
-        # Use information from SIMCOND and GeometryInfo
-        # Allows to be set to False by RichXPmt
-        geoCnvSvc.UseAlignment      = True
-        geoCnvSvc.AlignAllDetectors = True
-
-        # Define detectors
-        for det in self.getProp('DetectorGeo')['Detectors']:
-            det = "%s" %det
-            self.defineDetectorGeo( basePieces, detPieces, det )
-
-        # StreamItems definition needs to be after det definition
-        self.defineStreamItemsGeo( basePieces, detPieces )
-
-        # Define detector streams for RICHes
-        for det in self.getProp('DetectorGeo')['Detectors']:
-            det = "%s" %det
-            self.defineDetectorGeoStream( geoCnvSvc, det )
-
-        # Seperate Calo opts
-        # Returns a list containing all the elments common to both lists
-        if self.getProp('UseGaussGeo'):
-            if [det for det in ['Spd', 'Prs', 'Ecal', 'Hcal'] if det in self.getProp('DetectorGeo')['Detectors']]:
-                importOptions("$GAUSSCALOROOT/options/GaussGeo-Calo.py")
-        else:
-            if [det for det in ['Spd', 'Prs', 'Ecal', 'Hcal'] if det in self.getProp('DetectorGeo')['Detectors']]:
-                importOptions("$GAUSSCALOROOT/options/Calo.opts")
-
-
-        # Call GDML description
-        self.defineGDMLGeoStream( geoCnvSvc )
-
-        if self.getProp("Debug"):
-            print "\nDEBUG Detector Geometry Elements:"
-            print "\nkey : detPieces[key]"
-            for key in detPieces.keys():
-                print "%s : %s" %(key, detPieces[key])
-            print "\nkey : detPieces[key]"
-
-            for key in sorted(detPieces.keys()):
-                print "%s : %s" %(key, detPieces[key])
-
-            print "\nkey : basePieces[key]"
-            for key in basePieces.keys():
-                print "%s : %s" %(key, basePieces[key])
-
-            print "\nkey : Sorted basePieces[key]"
-            for key in sorted(basePieces.keys()):
-                print "%s : %s" %(key, basePieces[key])
-
-            print "\ngeo items:"
-            for item in self._listOfGeoObjects_:
-                print "%s" %(item)
-
-            print "\ngeo items SORTED:"
-            mySortedGeoStream = self._listOfGeoObjects_[:]
-            mySortedGeoStream.sort()
-            for item in mySortedGeoStream:
-                print "%s" %(item)
-
-        # No BP requested - therefore remove all elements from Geo.StreamItems
-        if ("BeamPipeOff" == self.getProp("BeamPipe")):
-            self.removeAllBeamPipeElements()
-
-        # Populate the list of geometry elements in the requested conversion service
-        for el in self._listOfGeoObjects_:
-            if self.getProp('UseGaussGeo'):
-                GaussGeo().GeoItemsNames.append(el)
-            else:
-                geo.StreamItems.append(el)
-
-
-#"""
-#     ><<                             ><<      ><< <<
-#  ><<   ><<                        ><       ><<    ><<  ><
-# ><<           ><<     ><< ><<   ><>< ><     ><<           ><<< ><< ><<
-# ><<         ><<  ><<   ><<  ><<   ><<         ><<     ><<  ><<  ><  ><<
-# ><<        ><<    ><<  ><<  ><<   ><<            ><<  ><<  ><<  ><  ><<
-#  ><<   ><<  ><<  ><<   ><<  ><<   ><<      ><<    ><< ><<  ><<  ><  ><<
-#    ><<<<      ><<     ><<<  ><<   ><<        ><< <<   ><< ><<<  ><  ><<
-#"""
-
-    def configureDetectorSim( self, slot, detHits, det, configuredRichSim ):
-        import string
-        det = det.lower()
-        if det not in self.__knownDetectors__:
-            log.warning("Sim Detector not known : %s" %(det))
-
-        if det == "puveto":
-            self.configurePuVetoSim( slot, detHits )
-        elif det == "velo":
-            self.configureVeloSim( slot, detHits )
-        elif det == "tt":
-            self.configureTTSim( slot, detHits )
-        elif det == "it":
-            self.configureITSim( slot, detHits )
-        elif det == "ot":
-            self.configureOTSim( slot, detHits )
-        elif det == "muon":
-            self.configureMuonSim( slot, detHits )
-        elif det in ['rich1', 'rich2']:
-            if not configuredRichSim[0]:
-                self.configureRichSim( slot, detHits )
-                configuredRichSim[0] = True
-        elif det == "spd":
-            self.configureSpdSim( slot, detHits )
-        elif det == "prs":
-            self.configurePrsSim( slot, detHits )
-        elif det == "ecal":
-            self.configureEcalSim( slot, detHits )
-        elif det == "hcal":
-            self.configureHcalSim( slot, detHits )
-        elif det == "hc":
-            self.configureHCSim(slot, detHits)
-        # GC - 20160323 Bcm and Bls off for now
-        ## elif det == "bcm":
-        ##    self.configureBcmSim(slot, detHits)
-        ## elif det == "bls":
-        ##    self.configureBlsSim(slot, detHits)
-        # Upgrade detectors below
-        elif det == "vp":
-            self.configureVPSim( slot, detHits )
-        elif det == "torch":
-            self.configureTorchSim( slot, detHits )
-        elif (det == "ft") or (det == "ft-noshield"):
-            self.configureFTSim( slot, detHits )
-        elif det in ['rich1pmt', 'rich2pmt']:
-            if not configuredRichSim[0]:
-                self.configureRichMaPmtSim( slot, detHits )
-                configuredRichSim[0] = True
-        elif det == "ut":
-            self.configureUTSim( slot, detHits )
-        elif det == "sl":
-            self.configureSLSim( slot, detHits )
-        else:
-            if det != "magnet":
-            ## Magnetic field defined in defineMagnetGeoField called
-            ## via defineDetectorGeoStream in defineGeo
-                log.warning("Sim Detector not known : %s" %(det))
-
-    ##
-    ##
-    def configureSim( self, SpillOverSlots ):
-
-        """
-        Set up the simulation sequence
-        """
-
-        if "Simulation" not in self.getProp("Phases"):
-            log.warning("No simulation phase.")
-            return
-
-        ApplicationMgr().ExtSvc += [ "GiGa" ]
-        EventPersistencySvc().CnvServices += [ "GiGaKine" ]
-
-        gaussSimulationSeq = GaudiSequencer( "Simulation" )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussSimulationSeq ]
-
-        gigaStore = GiGaDataStoreAlgorithm( "GiGaStore" )
-        gigaStore.ConversionServices = [ "GiGaKine" ]
-        gaussSimulationSeq.Members += [ gigaStore ]
-
-        self.defineGeo()
-
-        self.configureGiGa()
-
-        if self.getProp('UseGaussGeo'):
-            GiGa().GeometrySource = "GaussGeo"
-        else:
-            GiGa().GeometrySource = "GiGaGeo"
-
-        for slot in SpillOverSlots:
-            TESNode = "/Event/"+self.slot_(slot)
-
-            mainSimSequence = GaudiSequencer( self.slotName(slot)+"EventSeq" )
-
-            gaussSimulationSeq.Members += [ mainSimSequence ]
-
-            mainSimSequence.Members +=  [ SimInit( self.slotName(slot)+"EventGaussSim",
-                                                   GenHeader = TESNode + "Gen/Header" ,
-                                                   MCHeader = TESNode + "MC/Header" ) ]
-
-            simSeq = GaudiSequencer( self.slotName(slot)+"Simulation",
-                                     RequireObjects = [ TESNode + "Gen/HepMCEvents" ] )
-            mainSimSequence.Members += [ simSeq ]
-
-            simSlotSeq = GaudiSequencer( "Make"+self.slotName(slot)+"Sim" )
-            simSeq.Members += [simSlotSeq]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : simSlotSeq.RootInTES = slot
-
-            genToSim = GenerationToSimulation( "GenToSim" + slot,
-                                               LookForUnknownParticles = True )
-            simSlotSeq.Members += [ genToSim ]
-
-            simSlotSeq.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot ) ]
-            simSlotSeq.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot ) ]
-            simToMC = SimulationToMCTruth( "SimToMCTruth"+slot )
-            simSlotSeq.Members += [ simToMC ]
-
-            ## Detectors hits
-            TESNode = TESNode + "MC/"
-            detHits = GaudiSequencer( "DetectorsHits" + slot )
-            simSlotSeq.Members += [ detHits ]
-
-            # Slight trick - configuredRichSim is a list and therefore MUTABLE!
-            configuredRichSim = [ False ]
-            for det in self.getProp('DetectorSim')['Detectors']:
-                self.configureDetectorSim( slot, detHits, det, configuredRichSim )
-
-
-            # Data packing ...
-            if self.getProp("EnablePack") :
-                packing = GaudiSequencer(self.slotName(slot)+"EventDataPacking")
-                simSlotSeq.Members += [ packing ]
-                SimConf().PackingSequencers[slot] = packing
-        # End of Sim Configuration
-
-
-
-
-#"""
-#  ><<       ><<
-#  >< ><<   ><<<                       ><
-#  ><< ><< > ><<    ><<     ><< ><<
-#  ><<  ><<  ><<  ><<  ><<   ><<  ><< ><<
-#  ><<   ><  ><< ><<    ><<  ><<  ><< ><<
-#  ><<       ><<  ><<  ><<   ><<  ><< ><<
-#  ><<       ><<    ><<     ><<<  ><< ><<
-#
-#
-#"""
-
-
-    def configureGeneratorMoni ( self, SpillOverSlots ):
-
-        # Monitors for the generator:
-        for slot in SpillOverSlots:
-
-            genSequence = GaudiSequencer("GeneratorSlot" + self.slotName(slot) + "Seq" )
-            genMoniSeq = GaudiSequencer("GenMonitor" + slot )
-            genSequence.Members += [ genMoniSeq ]
-
-            TESLocation = "/Event/"+self.slot_(slot)+"Gen/HepMCEvents"
-            genMoniSeq.Members += [
-                GenMonitorAlg(
-                "GenMonitorAlg"+slot,
-                HistoProduce=True,
-                Input = TESLocation
-                )
-                ]
-            #            if moniOpt == 'Debug':
-            #                genMoniSeq.Members += [ DumpHepMC( "DumpHepMC"+slot,
-            #                                                   OutputLevel=1,
-            #                                                   Addresses = [TESLocation] ) ]
-
-
-    def configureDetectorMoni(
-        self,
-        slot,
-        packCheckSeq,
-        detMoniSeq,
-        checkHits,
-        det,
-        configuredRichMoni
-        ):
-        import string
-        det = det.lower()
-        if det not in self.__knownDetectors__:
-            log.warning("Moni Detector not known : %s" %(det))
-
-        if det == "puveto":
-            self.configurePuVetoMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "velo":
-            self.configureVeloMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "tt":
-            self.configureTTMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "it":
-            self.configureITMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "ot":
-            self.configureOTMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "muon":
-            self.configureMuonMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        # Since I'm switching on the subcomponents I shouldn't configure this twice.
-        elif (det == "rich1") or (det == "rich2"):
-            if not configuredRichMoni[0]:
-                self.configureRichMoni(
-                    slot,
-                    packCheckSeq,
-                    detMoniSeq,
-                    checkHits,
-                    configuredRichMoni
-                    )
-                configuredRichMoni[0] = True
-        elif det == "prs":
-            self.configurePrsMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "spd":
-            self.configureSpdMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "ecal":
-            self.configureEcalMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "hcal":
-            self.configureHcalMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "hc":
-            self.configureHCMoni(slot, packCheckSeq, detMoniSeq, checkHits)
-        # GC - 20160323 Bls and Bc off for now
-        ## elif det == "bcm":
-        ##     self.configureBcmMoni(slot, packCheckSeq, detMoniSeq, checkHits)
-        ## elif det == "bls":
-        ##     self.configureBlsMoni(slot, packCheckSeq, detMoniSeq, checkHits)
-        # Upgrade detectors below
-        elif det == "vp":
-            self.configureVPMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "torch":
-            self.configureTorchMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif (det == "ft") or (det =="ft-noshield"):
-            self.configureFTMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif (det == "rich1pmt") or (det == "rich2pmt"):
-            if not configuredRichMoni[0]:
-                self.configureRichMaPmtMoni(
-                    slot,
-                    packCheckSeq,
-                    detMoniSeq,
-                    checkHits,
-                    configuredRichMoni
-                    )
-                configuredRichMoni[0] = True
-        elif det == "ut":
-            self.configureUTMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        elif det == "sl":
-            self.configureSLMoni( slot, packCheckSeq, detMoniSeq, checkHits )
-        else:
-            log.warning("Moni Detector not known : %s" %(det))
-
-    def resetCheckHits( self, checkHits ):
-        checkHits.TTHits     = ''
-        checkHits.OTHits     = ''
-        checkHits.ITHits     = ''
-        checkHits.PuVetoHits = ''
-        checkHits.VeloHits   = ''
-        checkHits.MuonHits   = ''
-        checkHits.RichHits   = ''
-        checkHits.CaloHits   = []
-
-        # checkHits has as default values:
-        # |-TTHits                    = 'MC/TT/Hits'
-        # |-OTHits                    = 'MC/OT/Hits'
-        # |-ITHits                    = 'MC/IT/Hits'
-        # |-PuVetoHits                = 'MC/PuVeto/Hits'
-        # |-VeloHits                  = 'MC/Velo/Hits'
-        # |-MuonHits                  = 'MC/Muon/Hits'
-        # |-RichTracks                = ''
-        # |-RichHits                  = 'MC/Rich/Hits'
-        # |-CaloHits                  = ['MC/Spd/Hits', 'MC/Prs/Hits', 'MC/Ecal/Hits', 'MC/Hcal/Hits']
-
-
-
-    def configureSimulationMoni( self, SpillOverSlots ):
-
-        configuredRichMoni = [ False , False ]
-
-        # Monitors for simulation
-        for slot in SpillOverSlots:
-            # Reset param to configure rich for slots.
-            configuredRichMoni[0] = False
-            TESNode = "/Event/"+self.slot_(slot)
-
-            simSequence = GaudiSequencer( self.slotName(slot)+"Simulation" )
-            simMoniSeq = GaudiSequencer( "SimMonitor" + slot )
-            simSequence.Members += [ simMoniSeq ]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : simMoniSeq.RootInTES = slot
-
-            # Basic monitors
-            simMoniSeq.Members += [
-                GiGaGetEventAlg("GiGaGet"+self.slotName(slot)+"Event"),
-                MCTruthMonitor( self.slotName(slot)+"MCTruthMonitor" ) ]
-
-            # can switch off detectors, or rather switch them on (see options
-            # of algorithm)
-            checkHits = GiGaGetHitsAlg( "GiGaGetHitsAlg" + slot )
-
-            # Possibly dangerous - set all strings to ''
-            # due to silly default values
-            self.resetCheckHits( checkHits )
-
-
-
-            simMoniSeq.Members += [ checkHits ]
-
-            # checkHits had default values:
-            # |-TTHits                    = 'MC/TT/Hits'
-            # |-OTHits                    = 'MC/OT/Hits'
-            # |-ITHits                    = 'MC/IT/Hits'
-            # |-PuVetoHits                = 'MC/PuVeto/Hits'
-            # |-VeloHits                  = 'MC/Velo/Hits'
-            # |-MuonHits                  = 'MC/Muon/Hits'
-            # |-RichTracks                = ''
-            # |-RichHits                  = 'MC/Rich/Hits'
-            # |-CaloHits                  = ['MC/Spd/Hits', 'MC/Prs/Hits', 'MC/Ecal/Hits', 'MC/Hcal/Hits']
-            # | (default: ['MC/Spd/Hits', 'MC/Prs/Hits', 'MC/Ecal/Hits', 'MC/Hcal/Hits'])
-
-
-            # Should add here the switching off of properties of
-            # GiGaGetHitsAlg when a given detector is not monitored
-            #self.configureTTMoni( checkHits )
-
-            # OverWrite some things if using VP
-            #self.configureVPMoni( checkHits )
-
-
-            #if moniOpt == 'Debug':
-            #    checkHits.OutputLevel = DEBUG
-
-            detMoniSeq = GaudiSequencer( "DetectorsMonitor" + slot )
-            simMoniSeq.Members += [ detMoniSeq ]
-
-            packCheckSeq = None
-            if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-
-                packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-                simMoniSeq.Members += [packCheckSeq]
-
-                upMCV = UnpackMCVertex("UnpackMCVertex"+slot,
-                                       OutputName = "MC/VerticesTest" )
-                upMCP = UnpackMCParticle( "UnpackMCParticle"+slot,
-                                          OutputName = "MC/ParticlesTest" )
-                packCheckSeq.Members += [ upMCV, upMCP ]
-
-                compMCV = CompareMCVertex( "CompareMCVertex"+slot,
-                                           TestName = "MC/VerticesTest" )
-                compMCP = CompareMCParticle( "CompareMCParticle"+slot,
-                                             TestName = "MC/ParticlesTest" )
-                packCheckSeq.Members += [ compMCV, compMCP ]
-            #=================================================
-
-
-            # Define detectors
-            for det in self.getProp('DetectorMoni')['Detectors']:
-                self.configureDetectorMoni(slot, packCheckSeq, detMoniSeq, checkHits, det, configuredRichMoni)
-
-
-#"""
-#     ><<                             ><<    ><<<<<                  ><<              ><<<<<<<                      ><<
-#  ><<   ><<                        ><       ><<   ><<               ><<              ><<    ><<                    ><<
-# ><<           ><<     ><< ><<   ><>< ><    ><<    ><<    ><<     ><>< ><    ><<     ><<    ><<    ><<        ><<< ><<  ><<
-# ><<         ><<  ><<   ><<  ><<   ><<      ><<    ><<  ><<  ><<    ><<    ><<  ><<  ><<<<<<<    ><<  ><<   ><<    ><< ><<
-# ><<        ><<    ><<  ><<  ><<   ><<      ><<    ><< ><<   ><<    ><<   ><<   ><<  ><<        ><<   ><<  ><<     ><><<
-#  ><<   ><<  ><<  ><<   ><<  ><<   ><<      ><<   ><<  ><<   ><<    ><<   ><<   ><<  ><<        ><<   ><<   ><<    ><< ><<
-#    ><<<<      ><<     ><<<  ><<   ><<      ><<<<<       ><< ><<<    ><<    ><< ><<< ><<          ><< ><<<    ><<< ><<  ><<
-#
-#"""
-#    def configureDataPackingMoni( self, SpillOverSlots, simMoniSeq ):
-#        # Data packing checks
-#        for slot in SpillOverSlots:
-#            if self.getProp("EnablePack") and self.getProp("DataPackingChecks") :
-#
-#                packCheckSeq = GaudiSequencer( "DataUnpackTest"+slot )
-#                simMoniSeq.Members += [packCheckSeq]
-#
-#                upMCV = UnpackMCVertex("UnpackMCVertex"+slot,
-#                                       OutputName = "MC/VerticesTest" )
-#                upMCP = UnpackMCParticle( "UnpackMCParticle"+slot,
-#                                          OutputName = "MC/ParticlesTest" )
-#                packCheckSeq.Members += [ upMCV, upMCP ]
-#
-#                compMCV = CompareMCVertex( "CompareMCVertex"+slot,
-#                                           TestName = "MC/VerticesTest" )
-#                compMCP = CompareMCParticle( "CompareMCParticle"+slot,
-#                                             TestName = "MC/ParticlesTest" )
-#                packCheckSeq.Members += [ compMCV, compMCP ]
-#            #=================================================
-
-
-
-
-#"""
-#    ><<                             ><<    ><<       ><<
-# ><<   ><<                        ><       >< ><<   ><<<                       ><
-#><<           ><<     ><< ><<   ><>< ><    ><< ><< > ><<    ><<     ><< ><<
-#><<         ><<  ><<   ><<  ><<   ><<      ><<  ><<  ><<  ><<  ><<   ><<  ><< ><<
-#><<        ><<    ><<  ><<  ><<   ><<      ><<   ><  ><< ><<    ><<  ><<  ><< ><<
-# ><<   ><<  ><<  ><<   ><<  ><<   ><<      ><<       ><<  ><<  ><<   ><<  ><< ><<
-#   ><<<<      ><<     ><<<  ><<   ><<      ><<       ><<    ><<     ><<<  ><< ><<
-#
-#"""
-
-
-
-
-    def configureMoni( self, SpillOverSlots ):
-        self.configureGeneratorMoni( SpillOverSlots )
-        # Per-detector configuration done here:
-        self.configureSimulationMoni( SpillOverSlots )
-        #self.configureDataPackingMoni( SpillOverSlots , simMoniSeq )
-
-        #if histOpt == 'Expert':
-        #    # For the moment do nothing
-        #    log.Warning("Not yet implemented")
-
-        # END OF MONI CONFIG
-
-
-
-
-
-
-
-#"""
-#     ><<                             ><<       ><<<<
-#  ><<   ><<                        ><        ><    ><<   ><
-# ><<           ><<     ><< ><<   ><>< ><    ><<                ><<       ><<
-# ><<         ><<  ><<   ><<  ><<   ><<      ><<         ><<  ><<  ><<  ><<  ><<
-# ><<        ><<    ><<  ><<  ><<   ><<      ><<   ><<<< ><< ><<   ><< ><<   ><<
-#  ><<   ><<  ><<  ><<   ><<  ><<   ><<       ><<    ><  ><<  ><<  ><< ><<   ><<
-#    ><<<<      ><<     ><<<  ><<   ><<        ><<<<<    ><<      ><<    ><< ><<<
-#                                                              ><<
-#"""
-    ##
-    ##
-    def configureGiGa(self , skipG4 = False ):
-         """
-         Set up the configuration for the G4 settings: physics list, cuts and actions
-         """
-         richUpgradeConfig = False
-         UpgradeRichPmtDetector=False
-         Run1Run2RichDetector=False
-
-         giga = GiGa()
-
-
-         # PSZ - Use self.getProp('DataType') in future
-         # This modification now being applied.  SE
-         if self.getProp("DataType") == "Upgrade" :
-             richUpgradeConfig=True
-
-         # Do some sanity checks for RICH
-         if [det for det in ['Rich1Pmt', 'Rich2Pmt'] if det in self.getProp('DetectorSim')['Detectors']]:
-             UpgradeRichPmtDetector = True
-             if richUpgradeConfig == False :
-                 log.warning( "Incompatible Datatype and Detector configuration for RICH Upgrade. Please check your Configration" )
-             else:
-                 log.info( "Using RICH simulation  configuration for Upgrade Run ")
-
-
-         if [det for det in ['Rich1', 'Rich2'] if det in self.getProp('DetectorSim')['Detectors']]:
-             Run1Run2RichDetector = True
-             if richUpgradeConfig == True :
-                 log.warning( "Incompaticle Datatype and Detector configuration for RICH in RUN1 and RUN2. Please check your Configuration")
-             else:
-                 log.info( "Using RICH simulation configuration for RUN1 and RUN2 ")
-
-         #end of sanity checks for RICH
-
-
-
-         ## setup the Physics list and the productions cuts
-         ## the following 2 lines commented out.
-         #if skipG4:
-         #    richPmt = False
-
-         self.setPhysList(richUpgradeConfig)
-
-         ## Mandatory G4 Run action
-         giga.addTool( GiGaRunActionSequence("RunSeq") , name="RunSeq" )
-         giga.RunAction = "GiGaRunActionSequence/RunSeq"
-         if not skipG4:
-             giga.RunSeq.addTool( TrCutsRunAction("TrCuts") , name = "TrCuts" )
-             # To simulate Herschel or BCM, we need to change the default cuts.
-             if 'HC' in self.getProp('DetectorSim')['Detectors']:
-               giga.RunSeq.TrCuts.MinZ = -125.0 * SystemOfUnits.m
-               giga.RunSeq.TrCuts.MaxZ =  125.0 * SystemOfUnits.m
-             # GC - 20160323 Bcm off for now
-             ## elif 'Bcm' in self.getProp('DetectorSim')['Detectors']:
-             ##   giga.RunSeq.TrCuts.MinZ = -25.0 * SystemOfUnits.m
-             giga.RunSeq.Members += [ "TrCutsRunAction/TrCuts" ]
-             giga.RunSeq.addTool( GiGaRunActionCommand("RunCommand") , name = "RunCommand" )
-             giga.RunSeq.Members += [ "GiGaRunActionCommand/RunCommand" ]
-             giga.RunSeq.RunCommand.BeginOfRunCommands = [
-                 "/tracking/verbose 0",
-                 "/tracking/storeTrajectory  1",
-                 "/process/eLoss/verbose -1" ]
-
-         giga.EventAction = "GiGaEventActionSequence/EventSeq"
-         giga.addTool( GiGaEventActionSequence("EventSeq") , name="EventSeq" )
-         giga.EventSeq.Members += [ "GaussEventActionHepMC/HepMCEvent" ]
-
-         giga.TrackingAction =   "GiGaTrackActionSequence/TrackSeq"
-         giga.addTool( GiGaTrackActionSequence("TrackSeq") , name = "TrackSeq" )
-         giga.TrackSeq.Members += [ "GaussPreTrackAction/PreTrack" ]
-
-         giga.SteppingAction =   "GiGaStepActionSequence/StepSeq"
-         giga.addTool( GiGaStepActionSequence("StepSeq") , name = "StepSeq" )
-
-         #Now Configure the  RICH Simulation. The old setup using options is kept for backward
-         #compatibility and may be removed in the future.
-
-         # RICH simulation configuration
-         if (richUpgradeConfig):
-             if (self.getProp("UpgradeRICHSimRunOption") != "clunker"):
-                mGaussCherenkovConf = GaussCherenkovConf()
-                mGaussCherenkovConf.InitializeGaussCherenkovConfiguration()
-                mGaussCherenkovConf.setUpgradeRichDetExistFlag(UpgradeRichPmtDetector)
-                mGaussCherenkovConf.setSkipUpgradeGeant4Flag(skipG4)
-                mGaussCherenkovConf.ApplyGaussCherenkovConfiguration(giga)
-
-             else:
-                 #keep the old options for backward compatibility for now. It may be removed in the future
-                 #The method has the following in but it shoul not be tied to the RICH!!
-                 #SimulationSvc().SimulationDbLocation = "$GAUSSROOT/xml/Simulation.xml"
-
-                 self.GaussCherenkovOldSetup(giga,UpgradeRichPmtDetector,skipG4 )
-         else:
-
-             if (self.getProp("CurrentRICHSimRunOption") != "clunker" ):
-                mGaussRICHConf= GaussRICHConf()
-                mGaussRICHConf.InitializeGaussRICHConfiguration()
-                mGaussRICHConf.setRichDetectorExistFlag(Run1Run2RichDetector)
-                mGaussRICHConf.setSkipGeant4RichFlag(skipG4 )
-                mGaussRICHConf.ApplyGaussRICHConfiguration(giga)
-
-             else:
-                 #keep the old options for backward compatibility for now. It may be removed in the future.
-                 self.GaussRICHOldSetup(giga,Run1Run2RichDetector ,skipG4 )
-
-         # End of RICH simulation configuration
-
-         giga.TrackSeq.Members += [ "GaussPostTrackAction/PostTrack" ]
-         giga.TrackSeq.Members += [ "GaussTrackActionHepMC/HepMCTrack" ]
-         giga.TrackSeq.addTool( GaussPostTrackAction("PostTrack") , name = "PostTrack" )
-
-         giga.TrackSeq.PostTrack.StoreAll          = False
-         giga.TrackSeq.PostTrack.StorePrimaries    = True
-         giga.TrackSeq.PostTrack.StoreMarkedTracks = True
-         giga.TrackSeq.PostTrack.StoreForcedDecays = True
-         giga.TrackSeq.PostTrack.StoreByOwnEnergy   = True
-         giga.TrackSeq.PostTrack.OwnEnergyThreshold = 100.0 * SystemOfUnits.MeV
-
-         giga.TrackSeq.PostTrack.StoreByChildProcess  = True
-         giga.TrackSeq.PostTrack.StoredChildProcesses = [ "RichG4Cerenkov", "Decay" ]
-         giga.TrackSeq.PostTrack.StoreByOwnProcess  = True
-         giga.TrackSeq.PostTrack.StoredOwnProcesses = [ "Decay" ]
-         giga.StepSeq.Members += [ "GaussStepAction/GaussStep" ]
-
-
-         giga.addTool( GiGaRunManager("GiGaMgr") , name="GiGaMgr" )
-         giga.GiGaMgr.RunTools += [ "GiGaSetSimAttributes" ]
-         giga.GiGaMgr.RunTools += [ "GiGaRegionsTool" ]
-         giga.GiGaMgr.addTool( GiGaSetSimAttributes() , name = "GiGaSetSimAttributes" )
-         giga.GiGaMgr.GiGaSetSimAttributes.OutputLevel = 4
-
-         # Second part went here
-
-         #return giga
-
-    def GaussRICHOldSetup(self,giga,Run1Run2RichDetector=True, skipG4=False):
-        #Old setup for GaussRICH which can be removed in the future.
-
-        from Configurables import ( GiGaPhysConstructorOp,GiGaPhysConstructorHpd )
-        if self.getProp("DataType") in self.Run2DataTypes :
-            # Line to remove AEROGEL warnings
-            SimulationSvc().SimulationDbLocation = "$GAUSSROOT/xml/SimulationRICHesOff.xml"
-        else:
-            SimulationSvc().SimulationDbLocation = "$GAUSSROOT/xml/Simulation.xml"
-
-        giga.ModularPL.addTool( GiGaPhysConstructorOp,name = "GiGaPhysConstructorOp" )
-        giga.ModularPL.addTool( GiGaPhysConstructorHpd,name = "GiGaPhysConstructorHpd" )
-        if Run1Run2RichDetector:
-            importOptions("$GAUSSRICHROOT/options/Rich.opts")
-            if self.getProp("DataType") in self.Run2DataTypes :
-                importOptions("$GAUSSRICHROOT/options/RichRemoveAerogel.opts")
-
-            giga.ModularPL.GiGaPhysConstructorOp.RichActivateRichPhysicsProcVerboseTag = True
-            giga.StepSeq.Members += [ "RichG4StepAnalysis4/RichStepAgelExit" ]
-            giga.StepSeq.Members += [ "RichG4StepAnalysis5/RichStepMirrorRefl" ]
-            if self.getProp("RICHRandomHits") == True :
-                giga.ModularPL.GiGaPhysConstructorOp.Rich2BackgrHitsActivate = True
-                giga.ModularPL.GiGaPhysConstructorOp.Rich2BackgrHitsProbabilityFactor = 0.5
-        else:
-            if not skipG4:
-                giga.ModularPL.GiGaPhysConstructorOp.RichOpticalPhysicsProcessActivate = False
-                giga.ModularPL.GiGaPhysConstructorHpd.RichHpdPhysicsProcessActivate = False
-
-
-    def GaussCherenkovOldSetup(self, giga, UpgradeRichPmtDetector=True, skipG4=False):
-        #Old set up for GaussCherenkov which can removed in the future
-        from Configurables import ( GiGaPhysConstructorOpCkv, GiGaPhysConstructorPhotoDetector)
-        # Line to remove AEROGEL warnings
-        SimulationSvc().SimulationDbLocation = "$GAUSSROOT/xml/SimulationRICHesOff.xml"
-        if UpgradeRichPmtDetector :
-            importOptions("$GAUSSCHERENKOVROOT/options/GaussCherenkov.opts")
-            giga.ModularPL.addTool( GiGaPhysConstructorOpCkv, name="GiGaPhysConstructorOpCkv" )
-            giga.ModularPL.addTool(GiGaPhysConstructorPhotoDetector, name="GiGaPhysConstructorPhotoDetector")
-            giga.ModularPL.GiGaPhysConstructorOpCkv.RichActivateRichPhysicsProcVerboseTag = True
-            giga.StepSeq.Members += [ "RichG4StepAnalysis4/RichStepAgelExit" ]
-            giga.StepSeq.Members += [ "RichG4StepAnalysis5/RichStepMirrorRefl" ]
-            if skipG4:
-                giga.ModularPL.GiGaPhysConstructorOpCkv.RichOpticalPhysicsProcessActivate = False
-                giga.ModularPL.GiGaPhysConstructorPhotoDetector.RichPmtPhysicsProcessActivate = False
-
-
-
-
-#"""
-#
-#     ><<                             ><<       ><<<<
-#  ><<   ><<                        ><        ><    ><<        ><<
-# ><<           ><<     ><< ><<   ><>< ><    ><<             > ><<
-# ><<         ><<  ><<   ><<  ><<   ><<      ><<            >< ><<
-# ><<        ><<    ><<  ><<  ><<   ><<      ><<   ><<<<  ><<  ><<
-#  ><<   ><<  ><<  ><<   ><<  ><<   ><<       ><<    ><  ><<<< >< ><<
-#    ><<<<      ><<     ><<<  ><<   ><<        ><<<<<          ><<
-#
-#
-#"""
-
-    ##
-    ## Configure the sequence to transform HepMC into MCParticles
-    ## skipping Geant4
-    def configureSkipGeant4( self, SpillOverSlots ):
-
-        """
-        Set up the sequence to transform HepMC into MCParticles
-        """
-
-        if "GenToMCTree" not in self.getProp("Phases"):
-            log.warning("No GenToMCTree phase.")
-            return
-
-        # Do not do detector simulation in this case
-        self.getProp('DetectorSim')['Detectors'] = []
-        self.getProp('DetectorGeo')['Detectors'] = []
-        self.getProp('DetectorMoni')['Detectors'] = []
-
-        ApplicationMgr().ExtSvc += [ "GiGa" ]
-
-        gaussSkipGeant4Seq = GaudiSequencer( "SkipGeant4" )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussSkipGeant4Seq ]
-
-        self.configureGiGa( True )
-
-        for slot in SpillOverSlots:
-
-            TESNode = "/Event/"+self.slot_(slot)
-
-            mainSkipGeant4Sequence = GaudiSequencer( self.slotName(slot)+"EventSeq" )
-
-            gaussSkipGeant4Seq.Members += [ mainSkipGeant4Sequence ]
-
-            mainSkipGeant4Sequence.Members +=  [ SimInit( self.slotName(slot)+"EventGaussSkipGeant4",
-                                                          GenHeader = TESNode + "Gen/Header" ,
-                                                          MCHeader = TESNode + "MC/Header" ) ]
-
-            skipGeant4Seq = GaudiSequencer( self.slotName(slot)+"SkipGeant4",
-                                            RequireObjects = [ TESNode + "Gen/HepMCEvents" ] )
-            mainSkipGeant4Sequence.Members += [ skipGeant4Seq ]
-
-            skipGeant4SlotSeq = GaudiSequencer( "Make"+self.slotName(slot)+"SkipGeant4" )
-            skipGeant4Seq.Members += [skipGeant4SlotSeq]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : skipGeant4SlotSeq.RootInTES = slot
-
-            genToSim = GenerationToSimulation( "GenToSim" + slot,
-                                               SkipGeant = True )
-            skipGeant4SlotSeq.Members += [ genToSim ]
-
-            # Data packing ...
-            if self.getProp("EnablePack") :
-                packing = GaudiSequencer(self.slotName(slot)+"EventDataPacking")
-                skipGeant4SlotSeq.Members += [ packing ]
-                SimConf().PackingSequencers[slot] = packing
-
-
-#"""
-#   ><< <<                ><<      ><<<<<<<
-# ><<    ><<              ><<      ><<    ><< ><<
-#  ><<          ><<     ><>< ><    ><<    ><< ><<      ><<   ><<  ><<<<
-#    ><<      ><   ><<    ><<      ><<<<<<<   >< ><     ><< ><<  ><<
-#       ><<  ><<<<< ><<   ><<      ><<        ><<  ><<    ><<<     ><<<
-# ><<    ><< ><           ><<      ><<        ><   ><<     ><<       ><<
-#   ><< <<     ><<<<       ><<     ><<        ><<  ><<    ><<    ><< ><<
-#                                                       ><<
-#"""
-
-    def setPhysList( self, richUpgradeConfig ):
-
-        giga = GiGa()
-        giga.addTool( GiGaPhysListModular("ModularPL") , name="ModularPL" )
-        giga.PhysicsList = "GiGaPhysListModular/ModularPL"
-        gmpl = giga.ModularPL
-
-        ## set production cuts
-        ecut = 5.0 * SystemOfUnits.mm
-        if not self.getProp("DeltaRays"):
-            ecut = 10000.0 * SystemOfUnits.m
-        print 'Ecut value =', ecut
-        gmpl.CutForElectron = ecut
-        gmpl.CutForPositron = 5.0 * SystemOfUnits.mm
-        gmpl.CutForGamma    = 5.0 * SystemOfUnits.mm
-
-        ## set up the physics list
-        hadronPhys = self.getProp('PhysicsList')['Hadron']
-        emPhys     = self.getProp('PhysicsList')['Em']
-        lhcbPhys   = self.getProp('PhysicsList')['LHCbPhys']
-        genPhys    = self.getProp('PhysicsList')['GeneralPhys']
-        otherPhys  = ''
-        if self.getProp('PhysicsList').has_key('Other'):
-            otherPhys = self.getProp('PhysicsList')['Other']
-
-        def gef(name):
-            import Configurables
-            return getattr(Configurables, "GiGaExtPhysics_%s_" % name)
-        def addConstructor(template, name):
-            gmpl.addTool(gef(template), name = name)
-            gmpl.PhysicsConstructors.append(getattr(gmpl, name))
-
-        ## --- EM physics:
-        if  (emPhys == "Opt1"):
-            addConstructor("G4EmStandardPhysics_option1", "EmOpt1Physics")
-        elif(emPhys == "Opt2"):
-            addConstructor("G4EmStandardPhysics_option2", "EmOpt2Physics")
-        elif(emPhys == "Opt3"):
-            addConstructor("G4EmStandardPhysics_option3", "EmOpt3Physics")
-        elif(emPhys == "Std"):
-            addConstructor("G4EmStandardPhysics", "EmPhysics")
-        elif(emPhys == "NoCuts"):
-            addConstructor("G4EmStandardPhysics_option1NoApplyCuts", "EmOpt1NoCutsPhysics")
-        elif(emPhys.find("LHCb") != -1):
-            if(emPhys.find("Test") != -1 ):
-                addConstructor("G4EmStandardPhysics_LHCbTest", "EmOpt1LHCbPhysics")
-            else:
-                addConstructor("G4EmStandardPhysics_option1LHCb", "EmOpt1LHCbPhysics")
-            # overwrite cuts depending on choice of list
-            if(emPhys.find("NoCuts") != -1 ):
-                gmpl.EmOpt1LHCbPhysics.ApplyCuts = False
-            if(emPhys.find("OldForE") != -1 ):
-                gmpl.EmOpt1LHCbPhysics.NewModelForE = False
-
-            #gmpl.EmOpt1LHCbPhysics.OutputLevel = VERBOSE
-        else:
-            raise RuntimeError("Unknown Em PhysicsList chosen ('%s')"%emPhys)
-
-        ## --- general  physics (common to all PL):
-        if (genPhys == True):
-        ## Decays
-            addConstructor("G4DecayPhysics", "DecayPhysics" )
-        ## EM physics: Synchroton Radiation & gamma,electron-nuclear Physics
-            addConstructor("G4EmExtraPhysics", "EmExtraPhysics")
-        ## Hadron physics: Hadron elastic scattering
-        ##    addConstructor("G4HadronElasticPhysics", "ElasticPhysics")
-        ## now specialised for different constructors
-        ## Ions physics
-            addConstructor("G4IonPhysics", "IonPhysics")
-        elif (genPhys == False):
-            log.warning("The general physics (Decays, hadron elastic, ion ...) is disabled")
-        else:
-            raise RuntimeError("Unknown setting for GeneralPhys PhysicsList chosen ('%s')"%genPhys)
-
-        ## --- Hadron physics:
-        if(hadronPhys == "QGSP_BERT"):
-            addConstructor("G4HadronElasticPhysics", "ElasticPhysics")
-            addConstructor("G4HadronPhysicsQGSP_BERT", "QGSP_BERTPhysics")
-            addConstructor("G4StoppingPhysics", "StoppingPhysics")
-            addConstructor("G4NeutronTrackingCut", "NeutronTrkCut")
-        elif(hadronPhys == "QGSP_BERT_HP"):
-            addConstructor("G4HadronElasticPhysicsHP", "ElasticPhysicsHP")
-            addConstructor("G4HadronPhysicsQGSP_BERT_HP", "QGSP_BERT_HPPhysics")
-            addConstructor("G4StoppingPhysics", "StoppingPhysics")
-            # overwrite the defaut value of the HighPrecision property of the
-            # G4HadronElasticPhysics constructor: no longer true, use dedicated
-            # constructor
-            #gmpl.ElasticPhysics.HighPrecision = True
-            #gmpl.ElasticPhysics.OutputLevel = VERBOSE
-        elif(hadronPhys == "QGSP_FTFP_BERT"):
-            addConstructor("G4HadronElasticPhysics", "ElasticPhysics")
-            addConstructor("G4HadronPhysicsQGSP_FTFP_BERT", "QGSP_FTFP_BERTPhysics")
-            addConstructor("G4StoppingPhysics", "StoppingPhysics")
-            addConstructor("G4NeutronTrackingCut", "NeutronTrkCut")
-        elif(hadronPhys == "FTFP_BERT"):
-            addConstructor("G4HadronElasticPhysics", "ElasticPhysics")
-            addConstructor("G4HadronPhysicsFTFP_BERT", "FTFP_BERTPhysics")
-            addConstructor("G4StoppingPhysics", "StoppingPhysics")
-            addConstructor("G4NeutronTrackingCut", "NeutronTrkCut")
-        elif(hadronPhys == "FTFP_BERT_HP"):
-            addConstructor("G4HadronElasticPhysicsHP", "ElasticPhysicsHP")
-            addConstructor("G4HadronPhysicsFTFP_BERT_HP", "FTFP_BERT_HPPhysics")
-            addConstructor("G4StoppingPhysics", "StoppingPhysics")
-        else:
-            raise RuntimeError("Unknown Hadron PhysicsList chosen ('%s')"%hadronPhys)
-
-
-        # Add Redecay tag particle physics list if necessary
-        # This is also necessary for the pure SplitSim setting as the ReDecay
-        # infrastructure is used.
-        if self.Redecay['active'] or self.getProp("SplitSim"):
-            from Configurables import GiGaPhysG4RDTag
-            gmpl.addTool(GiGaPhysG4RDTag)
-            gmpl.PhysicsConstructors.append(gmpl.GiGaPhysG4RDTag)
-
-
-        ## --- LHCb specific physics:
-        if  (lhcbPhys == True):
-            if (richUpgradeConfig == True):
-                self.defineRichMaPmtPhys(gmpl)
-            else:
-                self.defineRichPhys(gmpl)
-
-        ## LHCb particles unknown to default Geant4
-            gmpl.PhysicsConstructors.append("GiGaPhysUnknownParticles")
-        elif (lhcbPhys == False):
-            log.warning("The lhcb-related physics (RICH processed, UnknownParticles) is disabled")
-        else:
-            raise RuntimeError("Unknown setting for LHCbPhys PhysicsList chosen ('%s')"%lhcbPhys)
-
-        ## and other exotic physics
-        if (otherPhys == 'Higgs'):
-            log.info("Enabling physics processe for Higgs particles")
-            gmpl.PhysicsConstructors.append("GiGaHiggsParticles")
-        else:
-            if (otherPhys != '' ):
-               raise RuntimeError("Unknown setting for OtherPhys PhysicsList chosen ('%s')"%otherPhys)
-
-
-
-#"""
-#      ><                           ><<                 ><<                             ><<
-#     >< <<                         ><<              ><<   ><<                        ><
-#    ><  ><<     >< ><<   >< ><<    ><< ><<   ><<   ><<           ><<     ><< ><<   ><>< ><
-#   ><<   ><<    ><  ><<  ><  ><<   ><<  ><< ><<    ><<         ><<  ><<   ><<  ><<   ><<
-#  ><<<<<< ><<   ><   ><< ><   ><<  ><<    ><<<     ><<        ><<    ><<  ><<  ><<   ><<
-# ><<       ><<  ><< ><<  ><< ><<   ><<     ><<      ><<   ><<  ><<  ><<   ><<  ><<   ><<
-#><<         ><< ><<      ><<      ><<<    ><<         ><<<<      ><<     ><<<  ><<   ><<
-#                ><<      ><<            ><<
-#"""
-
-    ##
-    ##
-    ## Apply the configuration
-    def __apply_configuration__(self):
-
-        GaudiKernel.ProcessJobOptions.PrintOff()
-
-        #defineDB() in Boole and
-        self.configureRndmEngine()
-        self.configureInput()  #defineEvents() in both Boole and Brunel
-        LHCbApp( Simulation = True ) # in Boole? where?
-
-        # raise an error if DetectorGeo/Sim/Moni dictionaries are incompatible
-        self.checkGeoSimMoniDictionary()
-
-        self.checkIncompatibleDetectors()
-
-        self.setLHCbAppDetectors()
-
-        #propagate info to SimConf
-        self.propagateSimConf()
-
-        #Construct Crossing List
-        crossingList = self.defineCrossingList()
-
-        # We want to pass this GenInit object to configure phases later
-        from Configurables import ( Generation )
-        genInitPrime = GenInit( "GaussGen" )
-
-        self.setBeamParameters( crossingList, genInitPrime )
-        # PSZ - everything happens here
-        self.configurePhases( crossingList  )  # in Boole, defineOptions() in Brunel
-
-
-        #--Configuration of output files and 'default' outputs files that can/should
-        #--be overwritten in Gauss-Job.py
-        self.defineOutput( crossingList )
-
-        self.defineMonitors()
-        self.saveHistos()
-
-        GaudiKernel.ProcessJobOptions.PrintOn()
-        log.info( self )
-        GaudiKernel.ProcessJobOptions.PrintOff()
-
-        # Print out TES contents at the end of each event
-        #from Configurables import StoreExplorerAlg
-        #GaudiSequencer("GaussSequencer").Members += [ StoreExplorerAlg() ]
-
-
-# _____          _
-#|  __ \        | |
-#| |__) |___  __| | ___  ___ __ _ _   _
-#|  _  // _ \/ _` |/ _ \/ __/ _` | | | |
-#| | \ \  __/ (_| |  __/ (_| (_| | |_| |
-#|_|  \_\___|\__,_|\___|\___\__,_|\__, |
-#                                  __/ |
-#                                 |___/
-
-    def configure_redecay_mchits(self, slot, loc):
-        if 'Signal' not in slot:
-            GaussRedecayCopyToService('GaussRedecayCopyToService' + slot).MCHitsLocation += [loc]
-            GaussRedecayRetrieveFromService('GaussRedecayRetrieveFromService' + slot).MCHitsLocation += [loc]
-
-
-    def configure_redecay_mccalohits(self, slot, loc):
-        if 'Signal' not in slot:
-            GaussRedecayCopyToService('GaussRedecayCopyToService' + slot).MCCaloHitsLocation += [loc]
-            GaussRedecayRetrieveFromService('GaussRedecayRetrieveFromService' + slot).MCCaloHitsLocation += [loc]
-
-
-    def configureRedecay(self, SpillOverSlots ):
-        """Apply final configuration to the redecay configurables, especially set
-        the correct GaussRedecay Service instances for the different spillover
-        slots"""
-        n_redecays = self.Redecay['N']
-        rd_mode = self.Redecay['rd_mode']
-
-        genInit = GenInit('SignalGen')
-        if self.isGaussMP():
-            genInit.EvtCounter = "EvtCounter"
-        genInitT0 = GenInit("GaussGen")
-        if genInitT0.isPropertySet("RunNumber"):
-            genInit.RunNumber = genInitT0.RunNumber
-        if genInitT0.isPropertySet("FirstEventNumber"):
-            genInit.FirstEventNumber = genInitT0.FirstEventNumber
-
-        for slot in SpillOverSlots:
-            svcname = 'GaussRedecay' + slot
-            ApplicationMgr().ExtSvc += ['GaussRedecay/GaussRedecay' + slot]
-            GaussRedecay(svcname).Phase = 1
-            GaussRedecay(svcname).nRedecay = n_redecays
-            GaussRedecay(svcname).RedecayMode = rd_mode
-
-            if slot == '':
-                continue
-            GaussRedecayCopyToService(
-                'GaussRedecayCopyToService' + slot).GaussRedecay = svcname
-            GaussRedecayRetrieveFromService(
-                'GaussRedecayRetrieveFromService' + slot).GaussRedecay = svcname
-            GaussRedecayCtrFilter(
-                'RegisterNewEvent' + slot).GaussRedecay = svcname
-            GaussRedecayCtrFilter(
-                'CheckIfFullOrUESim' + slot).GaussRedecay = svcname
-            GaussRedecayCtrFilter(
-                'CheckIfSignalSim2' + slot).GaussRedecay = svcname
-
-        from Configurables import RedecayProduction
-        from Configurables import GaussRedecayFakePileUp
-
-        sig_gen = Generation('GenerationSignal')
-        org_gen = Generation('Generation')
-
-        sig_gen.EventType = org_gen.EventType
-        sig_gen.SampleGenerationTool = "SignalPlain"
-        sig_gen.addTool(SignalPlain)
-
-        sig_gen.PileUpTool = "GaussRedecayFakePileUp"
-        sig_gen.addTool(GaussRedecayFakePileUp)
-        sig_gen.VertexSmearingTool = ""
-
-        # Signal SampleGenerationTool
-        sig_sgt = sig_gen.SignalPlain
-        sig_sgt.ProductionTool = "RedecayProduction"
-        sig_sgt.addTool(RedecayProduction)
-        sig_sgt.RevertWhenBackward = False
-
-        # Turn of GenFSR for the Signal portion (not needed as it gives
-        # biased efficiencies anyway and is a pain to set up)
-        sig_gen.GenFSRLocation = ""
-        sig_sgt.GenFSRLocation = ""
-
-        # Original SampleGenerationTool to get the PIDList and CutTool
-        org_sgt_name = org_gen.SampleGenerationTool.split('/')[-1]
-        org_sgt = getattr(org_gen, org_sgt_name)
-        if type(org_sgt) is not Special:
-            sig_sgt.SignalPIDList = org_sgt.SignalPIDList
-            if hasattr(org_sgt, 'DecayTool'):
-                sig_sgt.DecayTool = org_sgt.DecayTool
-        else:
-            print "Special production detected"
-            org_prd_name = org_sgt.ProductionTool
-            org_prod = getattr(org_sgt, org_prd_name)
-
-            # Now try to import and test two special production tools
-            # In tries to avoid crashes just because it cannot be imported
-            try:
-                from Configurables import BcVegPyProduction
-                if type(org_prod) is BcVegPyProduction:
-                    print "Modifying ReDecay with BcVegPy"
-                    violate = hasattr(org_prod, "ViolateGaugeInvariance")
-                    violate = getattr(org_prod, "ViolateGaugeInvariance") if violate else False
-                    if hasattr(org_prod, "MesonState") and violate:
-                        abspid = abs(getattr(org_prod, "MesonState"))
-                    else:
-                        abspid = 541
-                    PIDList = [abspid, -abspid]
-            except:
-                pass
-            try:
-                from Configurables import GenXiccProduction
-                baryon_names = {
-                    "Xi_cc++": 4422,
-                    "Xi_cc+": 4412,
-                    "Xi_bc+": 5242,
-                    "Xi_bc0": 5142,
-                    "Xi_bb0": 5522,
-                    "Xi_bb-": 5512
-                }
-
-                if type(org_prod) is GenXiccProduction:
-                    print "Modifying ReDecay with GenXicc"
-                    baryon = hasattr(org_prod, "BaryonState")
-                    baryon = getattr(org_prod, "BaryonState") if baryon else "Xi_cc+"
-                    abspid = baryon_names[baryon]
-                    PIDList = [abspid, -abspid]
-            except:
-                pass
-
-            sig_sgt.DecayTool = ""
-            sig_sgt.SignalPIDList = PIDList
-
-        # Set the correct names for the used decay tools
-        if hasattr(org_gen, 'DecayTool'):
-            sig_gen.DecayTool = org_gen.DecayTool
-
-        # Copy the CutTool if it exists
-        if hasattr(org_sgt, 'CutTool'):
-            org_ctl_name = org_sgt.CutTool.split('/')[-1]
-            sig_sgt.CutTool = org_sgt.CutTool
-            # Check if the cuttool is configured, might not be in case of
-            # simple ones like DaughtersInLHCb
-            if hasattr(org_sgt, org_ctl_name):
-                org_ctl = getattr(org_sgt, org_ctl_name)
-                sig_sgt.addTool(org_ctl, org_ctl_name)
-
-
-    def configureRedecaySim( self, SpillOverSlots ):
-
-        """
-        Set up the simulation sequence
-        """
-
-        if "Simulation" not in self.getProp("Phases"):
-            log.warning("No simulation phase.")
-            return
-
-        ApplicationMgr().ExtSvc += [ "GiGa" ]
-        EventPersistencySvc().CnvServices += [ "GiGaKine" ]
-
-        gaussSimulationSeq = GaudiSequencer( "Simulation" )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussSimulationSeq ]
-
-        gigaStore = GiGaDataStoreAlgorithm( "GiGaStore" )
-        gigaStore.ConversionServices = [ "GiGaKine" ]
-        gaussSimulationSeq.Members += [ gigaStore ]
-
-        self.defineGeo()
-
-        self.configureGiGa()
-
-        if self.getProp('UseGaussGeo'):
-            GiGa().GeometrySource = "GaussGeo"
-        else:
-            GiGa().GeometrySource = "GiGaGeo"
-
-        for slot in SpillOverSlots:
-
-            TESNode = "/Event/"+self.slot_(slot)
-
-            mainSimSequence = GaudiSequencer( self.slotName(slot)+"EventSeq" )
-
-            gaussSimulationSeq.Members += [ mainSimSequence ]
-
-            mainSimSequence.Members +=  [ SimInit( self.slotName(slot)+"EventGaussSim",
-                                                   GenHeader = TESNode + "Gen/Header" ,
-                                                   MCHeader = TESNode + "MC/Header" ) ]
-
-            # We might not have a HepMC events in the redecays, hence
-            # the requirement is removed and explicitly checked using an
-            # algorithm running at the beginning.
-            simSeq = GaudiSequencer( self.slotName(slot)+"Simulation" )
-
-            # simSeq used to have a requireObjects. Cannot do that anymore
-            # as redecay events do not have a HepMC event. Hence make a filter
-            # that decides based on the original event.
-            hepmcfilterseq = GaudiSequencer('HepMCFilterSeq' + self.slotName(slot), ModeOR=True)
-            hepmcfilter = GaussRedecayCtrFilter('HepMCFilter' + self.slotName(slot))
-            hepmcfilter.CheckFor = TESNode + "Gen/HepMCEvents"
-            hepmcfilterseq.Members += [hepmcfilter]
-
-            mainSimSequence.Members += [ hepmcfilterseq]
-            hepmcfilterseq.Members += [simSeq]
-
-            simSlotSeq = GaudiSequencer( "Make"+self.slotName(slot)+"Sim",
-                                         RequireObjects = [ TESNode + "Gen/HepMCEvents" ])
-            simSlotFullSeq = GaudiSequencer( "Make"+self.slotName(slot)+"FullSim",
-                                            ModeOR=True)
-
-            simSlotSeq.Members += [simSlotFullSeq]
-            simSeq.Members += [simSlotSeq]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : simSlotFullSeq.RootInTES = slot
-
-            # Following is the main sim of the event, either normal event or
-            # the underlying event component for redecay, filter out if this
-            # event does not need this information.
-            #
-            # Make a filter to turn this part off for the signal redecay part.
-            # Ask whether phase is 1 and set it to 2 later on. Only applies for
-            # redecay, setting to 2 ignored otherwise!
-            grdfilter = GaussRedecayCtrFilter(
-                'CheckIfFullOrUESim{}'.format(slot))
-            grdfilter.IsPhaseEqual = 2
-            simSlotFullSeq.Members += [ grdfilter]
-
-            # Migrate the actual work into a new sequence, only activated when
-            # the previous filter return false due to the OR mode
-            simSlotFullSeqImpl = GaudiSequencer(
-                "Make"+self.slotName(slot)+"FullSimImpl")
-            simSlotFullSeq.Members += [ simSlotFullSeqImpl]
-
-            genToSim = GenerationToSimulation( "GenToSim" + slot,
-                                               LookForUnknownParticles = True )
-            simSlotFullSeqImpl.Members += [ genToSim ]
-
-            simSlotFullSeqImpl.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot ) ]
-            simSlotFullSeqImpl.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot ) ]
-            simToMC = SimulationToMCTruth( "SimToMCTruth"+slot )
-            simSlotFullSeqImpl.Members += [ simToMC ]
-
-            ## Detectors hits
-            TESNode = TESNode + "MC/"
-            detHits = GaudiSequencer( "DetectorsHits" + slot )
-            simSlotFullSeqImpl.Members += [ detHits ]
-            simSlotFullSeqImpl.Members += [ GaussRedecayCopyToService(
-                'GaussRedecayCopyToService{}'.format(slot)
-            ) ]
-
-            # Slight trick - configuredRichSim is a list and therefore MUTABLE!
-            configuredRichSim = [ False ]
-            for det in self.getProp('DetectorSim')['Detectors']:
-                self.configureDetectorSim( slot, detHits, det, configuredRichSim )
-
-            # ################################################
-            # Signal part here
-            # ################################################
-            if slot == '':
-                TESNode = "/Event/"+self.slot_(slot)+"Signal/"
-                simSlotSignal = GaudiSequencer( "SignalSimulation")
-
-                gdh = GenInit('SignalGen')
-                if self.isGaussMP():
-                    gdh.EvtCounter = "EvtCounter"
-                self.setBeamParameters(self.defineCrossingList(), gdh)
-
-                gdh.MCHeader = TESNode+"Gen/Header"
-                gdh.CreateBeam = False
-                sdh = SimInit('SignalSim')
-
-                sdh.MCHeader = TESNode+"MC/Header"
-
-                simSlotSignal.Members += [ gdh]
-                simSlotSignal.Members += [ sdh]
-
-                simSlotSignalSeq = GaudiSequencer( "Make"+self.slotName(slot)+"SignalSim", ModeOR=True)
-                simSlotSignalSeqImpl = GaudiSequencer( "Make"+self.slotName(slot)+"SignalSimImpl")
-                simSeq.Members += [simSlotSignal]
-                simSlotSignal.Members += [simSlotSignalSeq]
-
-                grdfilter = GaussRedecayCtrFilter('CheckIfSignalSim')
-                grdfilter.IsPhaseEqual = 0
-                simSlotSignalSeq.Members = [grdfilter, simSlotSignalSeqImpl]
-
-                simSlotSignalSeqImpl.Members += [Generation("GenerationSignal")]
-                simSlotSignalSeqImpl.RootInTES = '{}Signal'.format(slot)
-
-                genToSim = GenerationToSimulation( "GenToSim" + slot + 'Signal',
-                                                LookForUnknownParticles = True )
-                # genToSim.SelectiveSimulationStep = 2
-                simSlotSignalSeqImpl.Members += [ genToSim ]
-
-                simSlotSignalSeqImpl.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot + 'Signal' ) ]
-                simSlotSignalSeqImpl.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot + 'Signal' ) ]
-                simToMC = SimulationToMCTruth( "SimToMCTruth"+slot + 'Signal' )
-                simSlotSignalSeqImpl.Members += [ simToMC ]
-
-                detHits = GaudiSequencer( "DetectorsHits" + slot + 'Signal' )
-                simSlotSignalSeqImpl.Members += [ detHits ]
-                simSlotSignalSeqImpl.Members += [ GaussRedecayPrintMCParticles('SignalPrint') ]
-
-                configuredRichSim = [ False ]
-                for det in self.getProp('DetectorSim')['Detectors']:
-                    self.configureDetectorSim( slot+'Signal', detHits, det, configuredRichSim )
-
-            # ##############################################
-            # End signal part
-            # ##############################################
-            loadSlotSeq = GaudiSequencer( "Load"+self.slotName(slot)+"Sim", ModeOR=True )
-            grdfilter = GaussRedecayCtrFilter('CheckIfSignalSim2{}'.format(slot))
-            grdfilter.IsPhaseNotEqual = 2
-            loadSlotSeq.RootInTES = slot
-            loadSlotSeq.Members += [
-                grdfilter,
-                GaussRedecayRetrieveFromService('GaussRedecayRetrieveFromService{}'.format(slot))]
-            simSeq.Members += [loadSlotSeq]
-            if slot == '':
-                grdfilter = GaussRedecayCtrFilter('CheckIfMerge')
-                grdfilter.IsPhaseEqual = 0
-                mergeSlotSeq = GaudiSequencer( "Merge"+self.slotName(slot)+"Sim", ModeOR=True )
-                GaussRedecayMergeAndClean().MCHitsLocation = GaussRedecayCopyToService().MCHitsLocation
-                GaussRedecayMergeAndClean().MCCaloHitsLocation = GaussRedecayCopyToService().MCCaloHitsLocation
-                mergeSlotSeq.Members += [
-                    #StoreExplorerAlg('BeforeMerge'),
-                    grdfilter,
-                    GaussRedecayMergeAndClean()]
-                    #GaussRedecayPrintMCParticles('FullPrint'),
-                    #StoreExplorerAlg('AfterMerge')]
-                simSeq.Members += [mergeSlotSeq]
-                GaudiSequencer('RichHitsSignal').Members = GaudiSequencer('RichHitsSignal').Members[:4]
-            richpaddingSlotSeq = GaudiSequencer( "RichPadding"+self.slotName(slot) )
-            richpaddingSlotSeq.RootInTES = slot
-            richpaddingSlotSeq.Members = GaudiSequencer('RichHits' + slot).Members[4:]
-            GaudiSequencer('RichHits' + slot).Members = GaudiSequencer('RichHits' + slot).Members[:4]
-            simSeq.Members += [richpaddingSlotSeq]
-
-
-            # Data packing ...
-            if self.getProp("EnablePack") :
-                packing = GaudiSequencer(self.slotName(slot)+"EventDataPacking")
-                simSeq.Members += [ packing ]
-                SimConf().PackingSequencers[slot] = packing
-
-
-    def configureSplitSim( self, SpillOverSlots ):
-
-        """
-        Set up the simulation sequence
-        """
-
-        if "Simulation" not in self.getProp("Phases"):
-            log.warning("No simulation phase.")
-            return
-
-        ApplicationMgr().ExtSvc += [ "GiGa" ]
-        EventPersistencySvc().CnvServices += [ "GiGaKine" ]
-
-        gaussSimulationSeq = GaudiSequencer( "Simulation" )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussSimulationSeq ]
-
-        gigaStore = GiGaDataStoreAlgorithm( "GiGaStore" )
-        gigaStore.ConversionServices = [ "GiGaKine" ]
-        gaussSimulationSeq.Members += [ gigaStore ]
-
-        self.defineGeo()
-
-        self.configureGiGa()
-
-        if self.getProp('UseGaussGeo'):
-            GiGa().GeometrySource = "GaussGeo"
-        else:
-            GiGa().GeometrySource = "GiGaGeo"
-
-        for slot in SpillOverSlots:
-
-            if slot == '':
-                ApplicationMgr().ExtSvc += ['GaussRedecay/GaussRedecay']
-                GaussRedecay().Phase = 1
-                GaussRedecay().nRedecay = 1
-
-            TESNode = "/Event/"+self.slot_(slot)
-
-            mainSimSequence = GaudiSequencer( self.slotName(slot)+"EventSeq" )
-
-            gaussSimulationSeq.Members += [ mainSimSequence ]
-
-            mainSimSequence.Members +=  [ SimInit( self.slotName(slot)+"EventGaussSim",
-                                                   GenHeader = TESNode + "Gen/Header" ,
-                                                   MCHeader = TESNode + "MC/Header" ) ]
-
-            simSeq = GaudiSequencer( self.slotName(slot)+"Simulation",
-                                     RequireObjects = [ TESNode + "Gen/HepMCEvents" ] )
-            mainSimSequence.Members += [ simSeq ]
-
-            simSlotSeq = GaudiSequencer( "Make"+self.slotName(slot)+"Sim" )
-            simSeq.Members += [simSlotSeq]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : simSlotSeq.RootInTES = slot
-
-            if slot == '':
-                gaussrdfilter = GaussRedecayCtrFilter('RegisterNewEvent')
-                gaussrdfilter.RegisterNewEvent = True
-                from Configurables import RedecayProduction
-                splitter = GaussHepMCSplitter()
-                splitter.ProductionTool = "RedecayProduction"
-                splitter.addTool(RedecayProduction)
-                simSlotSeq.Members += [ gaussrdfilter, splitter ]
-
-                # ################################################
-                # Split part here
-                # ################################################
-                if slot == '':
-                    TESNode = "/Event/Split/"
-                    simSlotSplit = GaudiSequencer( "SplitSimulation")
-                    simSlotSeq.Members += [ simSlotSplit ]
-
-                    gdh = GenInit('SignalGen')
-                    if self.isGaussMP():
-                        gdh.EvtCounter = "EvtCounter"
-                    self.setBeamParameters(self.defineCrossingList(), gdh)
-
-                    gdh.MCHeader = TESNode+"Gen/Header"
-                    gdh.CreateBeam = False
-                    # Dummy SimInit to make GenToSim happy
-                    # This will reset seeds but no simulation has yet been
-                    # done so everyone is happy
-                    sdh = SimInit('SplitSim')
-                    sdh.GenHeader = "/Event/Gen/Header"  # Use the main gen header to get the event and run number
-                    sdh.MCHeader = TESNode+"MC/Header"
-
-                    simSlotSplit.Members += [ sdh]
-
-                    simSlotSplitSeq = GaudiSequencer( "Make"+self.slotName(slot)+"SplitSim")
-                    simSlotSplit.Members += [simSlotSplitSeq]
-
-                    simSlotSplitSeq.RootInTES = '{}Split'.format(slot)
-
-                    genToSim = GenerationToSimulation( "GenToSim" + slot + 'Split',
-                                                    LookForUnknownParticles = True )
-                    # genToSim.SelectiveSimulationStep = 2
-                    simSlotSplitSeq.Members += [ genToSim ]
-
-                    simSlotSplitSeq.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot + 'Split' ) ]
-                    simSlotSplitSeq.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot + 'Split' ) ]
-                    simToMC = SimulationToMCTruth( "SimToMCTruth"+slot + 'Split' )
-                    simSlotSplitSeq.Members += [ simToMC ]
-
-                    detHits = GaudiSequencer( "DetectorsHits" + slot + 'Split' )
-                    simSlotSplitSeq.Members += [ detHits ]
-                    simSlotSplitSeq.Members += [ GaussRedecayPrintMCParticles('SplitPrint') ]
-
-                    configuredRichSim = [ False ]
-                    for det in self.getProp('DetectorSim')['Detectors']:
-                        self.configureDetectorSim( slot+'Split', detHits, det, configuredRichSim )
-
-                    if self.getProp("PostSimFilters") :
-                        filterSeq = GaudiSequencer("PostSimFilterSeq")
-                        filterSeq.RootInTES = '{}Split'.format(slot)
-                        simSlotSplitSeq.Members += [ filterSeq ]
-                # ################################################
-                # Split part end
-                # ################################################
-
-            genToSim = GenerationToSimulation( "GenToSim" + slot,
-                                               LookForUnknownParticles = True )
-            simSlotSeq.Members += [ genToSim ]
-
-            simSlotSeq.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot ) ]
-            simSlotSeq.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot ) ]
-            simToMC = SimulationToMCTruth( "SimToMCTruth"+slot )
-            simSlotSeq.Members += [ simToMC ]
-
-            ## Detectors hits
-            TESNode = TESNode + "MC/"
-            detHits = GaudiSequencer( "DetectorsHits" + slot )
-            simSlotSeq.Members += [ detHits ]
-
-            # Slight trick - configuredRichSim is a list and therefore MUTABLE!
-            configuredRichSim = [ False ]
-            for det in self.getProp('DetectorSim')['Detectors']:
-                self.configureDetectorSim( slot, detHits, det, configuredRichSim )
-
-            # Merge the split
-            if slot == '':
-                mergeSlotSeq = GaudiSequencer( "Merge"+self.slotName(slot)+"Sim")
-                GaussRedecayMergeAndClean().SignalTESROOT = 'Split/'
-                GaussRedecayMergeAndClean().MCHitsLocation = GaussRedecayCopyToService().MCHitsLocation
-                GaussRedecayMergeAndClean().MCCaloHitsLocation = GaussRedecayCopyToService().MCCaloHitsLocation
-                mergeSlotSeq.Members += [
-                    GaussRedecayMergeAndClean()]
-                simSlotSeq.Members += [mergeSlotSeq]
-                GaudiSequencer('RichHitsSplit').Members = GaudiSequencer('RichHitsSplit').Members[:4]
-                richpaddingSlotSeq = GaudiSequencer( "RichPadding"+self.slotName(slot) )
-                richpaddingSlotSeq.RootInTES = slot
-                richpaddingSlotSeq.Members = GaudiSequencer('RichHits' + slot).Members[4:]
-                GaudiSequencer('RichHits' + slot).Members = GaudiSequencer('RichHits' + slot).Members[:4]
-                mergeSlotSeq.Members += [richpaddingSlotSeq]
-
-            # Data packing ...
-            if self.getProp("EnablePack") :
-                packing = GaudiSequencer(self.slotName(slot)+"EventDataPacking")
-                simSlotSeq.Members += [ packing ]
-                SimConf().PackingSequencers[slot] = packing
-        # End of Sim Configuration
-
-
-    def configureRedecaySplitSim( self, SpillOverSlots ):
-
-        """
-        Set up the simulation sequence for the combination of redecay with a
-        split simulation phase for the signal portion
-        AKA the Franken-Config
-
-        The plan:
-            1. Have the normal GaussRedecay setup in place with its services
-            2. Hook in another Redecay service for the split simulation
-            3. Hope for the best
-        """
-
-        if "Simulation" not in self.getProp("Phases"):
-            log.warning("No simulation phase.")
-            return
-
-        ApplicationMgr().ExtSvc += [ "GiGa" ]
-        EventPersistencySvc().CnvServices += [ "GiGaKine" ]
-
-        gaussSimulationSeq = GaudiSequencer( "Simulation" )
-        gaussSeq = GaudiSequencer("GaussSequencer")
-        gaussSeq.Members += [ gaussSimulationSeq ]
-
-        gigaStore = GiGaDataStoreAlgorithm( "GiGaStore" )
-        gigaStore.ConversionServices = [ "GiGaKine" ]
-        gaussSimulationSeq.Members += [ gigaStore ]
-
-        self.defineGeo()
-
-        self.configureGiGa()
-
-        if self.getProp('UseGaussGeo'):
-            GiGa().GeometrySource = "GaussGeo"
-        else:
-            GiGa().GeometrySource = "GiGaGeo"
-
-        # Configure the new service
-        svcname = 'GaussSplitRedecay'
-        ApplicationMgr().ExtSvc += ['GaussRedecay/'+svcname]
-        GaussRedecay(svcname).Phase = 1
-        GaussRedecay(svcname).nRedecay = 1
-        GaussRedecay(svcname).Offset = 50  # offset pdg placeholder by 50 to not collide with the actual redecay service
-
-        for slot in SpillOverSlots:
-
-            TESNode = "/Event/"+self.slot_(slot)
-
-            mainSimSequence = GaudiSequencer( self.slotName(slot)+"EventSeq" )
-
-            gaussSimulationSeq.Members += [ mainSimSequence ]
-
-            mainSimSequence.Members +=  [ SimInit( self.slotName(slot)+"EventGaussSim",
-                                                   GenHeader = TESNode + "Gen/Header" ,
-                                                   MCHeader = TESNode + "MC/Header" ) ]
-
-            # We might not have a HepMC events in the redecays, hence
-            # the requirement is removed and explicitly checked using an
-            # algorithm running at the beginning.
-            simSeq = GaudiSequencer( self.slotName(slot)+"Simulation" )
-
-            # simSeq used to have a requireObjects. Cannot do that anymore
-            # as redecay events do not have a HepMC event. Hence make a filter
-            # that decides based on the original event.
-            hepmcfilterseq = GaudiSequencer('HepMCFilterSeq' + self.slotName(slot), ModeOR=True)
-            hepmcfilter = GaussRedecayCtrFilter('HepMCFilter' + self.slotName(slot))
-            hepmcfilter.CheckFor = TESNode + "Gen/HepMCEvents"
-            hepmcfilterseq.Members += [hepmcfilter]
-
-            mainSimSequence.Members += [ hepmcfilterseq]
-            hepmcfilterseq.Members += [simSeq]
-
-            simSlotSeq = GaudiSequencer( "Make"+self.slotName(slot)+"Sim",
-                                         RequireObjects = [ TESNode + "Gen/HepMCEvents" ])
-            simSlotFullSeq = GaudiSequencer( "Make"+self.slotName(slot)+"FullSim",
-                                            ModeOR=True)
-
-            simSlotSeq.Members += [simSlotFullSeq]
-            simSeq.Members += [simSlotSeq]
-
-            # CRJ : Set RootInTES - Everything down stream will then use the correct location
-            #       (assuming they use GaudiAlg get and put) so no need to set data locations
-            #       by hand any more ...
-            if slot != '' : simSlotFullSeq.RootInTES = slot
-
-            # Following is the main sim of the event, either normal event or
-            # the underlying event component for redecay, filter out if this
-            # event does not need this information.
-            #
-            # Make a filter to turn this part off for the signal redecay part.
-            # Ask whether phase is 1 and set it to 2 later on. Only applies for
-            # redecay, setting to 2 ignored otherwise!
-            grdfilter = GaussRedecayCtrFilter(
-                'CheckIfFullOrUESim{}'.format(slot))
-            grdfilter.IsPhaseEqual = 2
-            simSlotFullSeq.Members += [ grdfilter]
-
-            # Migrate the actual work into a new sequence, only activated when
-            # the previous filter return false due to the OR mode
-            simSlotFullSeqImpl = GaudiSequencer(
-                "Make"+self.slotName(slot)+"FullSimImpl")
-            simSlotFullSeq.Members += [ simSlotFullSeqImpl]
-
-            genToSim = GenerationToSimulation( "GenToSim" + slot,
-                                               LookForUnknownParticles = True )
-            simSlotFullSeqImpl.Members += [ genToSim ]
-
-            simSlotFullSeqImpl.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot ) ]
-            simSlotFullSeqImpl.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot ) ]
-            simToMC = SimulationToMCTruth( "SimToMCTruth"+slot )
-            simSlotFullSeqImpl.Members += [ simToMC ]
-
-            ## Detectors hits
-            TESNode = TESNode + "MC/"
-            detHits = GaudiSequencer( "DetectorsHits" + slot )
-            simSlotFullSeqImpl.Members += [ detHits ]
-            simSlotFullSeqImpl.Members += [ GaussRedecayCopyToService(
-                'GaussRedecayCopyToService{}'.format(slot)
-            ) ]
-
-            # Slight trick - configuredRichSim is a list and therefore MUTABLE!
-            configuredRichSim = [ False ]
-            for det in self.getProp('DetectorSim')['Detectors']:
-                self.configureDetectorSim( slot, detHits, det, configuredRichSim )
-
-            # ################################################
-            # Signal part here
-            # ################################################
-            if slot == '':
-                TESNode = "/Event/"+self.slot_(slot)+"Signal/"
-                simSlotSignal = GaudiSequencer( "SignalSimulation")
-
-                gdh = GenInit('SignalGen')
-                if self.isGaussMP():
-                    gdh.EvtCounter = "EvtCounter"
-                self.setBeamParameters(self.defineCrossingList(), gdh)
-
-                gdh.MCHeader = TESNode+"Gen/Header"
-                gdh.CreateBeam = False
-                sdh = SimInit('SignalSim')
-
-                sdh.MCHeader = TESNode+"MC/Header"
-
-                simSlotSignal.Members += [ gdh]
-                simSlotSignal.Members += [ sdh]
-
-                simSlotSignalSeq = GaudiSequencer( "Make"+self.slotName(slot)+"SignalSim", ModeOR=True)
-                simSlotSignalSeqImpl = GaudiSequencer( "Make"+self.slotName(slot)+"SignalSimImpl")
-                simSeq.Members += [simSlotSignal]
-                simSlotSignal.Members += [simSlotSignalSeq]
-
-                grdfilter = GaussRedecayCtrFilter('CheckIfSignalSim')
-                grdfilter.IsPhaseEqual = 0
-                simSlotSignalSeq.Members = [grdfilter, simSlotSignalSeqImpl]
-
-                simSlotSignalSeqImpl.Members += [Generation("GenerationSignal")]
-                simSlotSignalSeqImpl.RootInTES = '{}Signal'.format(slot)
-
-                splitter = GaussHepMCSplitter()
-                splitter.ProductionTool = "RedecayProduction"
-                splitter.GaussRedecay = svcname
-
-                from Configurables import RedecayProduction
-                splitter.addTool(RedecayProduction)
-                splitter.RedecayProduction.GaussRedecay = svcname
-                gaussrdfilter = GaussRedecayCtrFilter('RegisterNewSplitEvent')
-                gaussrdfilter.RegisterNewEvent = True
-                gaussrdfilter.GaussRedecay = svcname
-                simSlotSignalSeqImpl.Members += [gaussrdfilter, splitter]
-
-                # ################################################
-                # Split part here
-                # ################################################
-                TESNode = "/Event/Signal/Split/"
-                simSlotSplit = GaudiSequencer( "SplitSimulation")
-                simSlotSignalSeqImpl.Members += [ simSlotSplit ]
-
-                gdh = GenInit('SplitGen')
-                if self.isGaussMP():
-                    gdh.EvtCounter = "EvtCounter"
-                self.setBeamParameters(self.defineCrossingList(), gdh)
-
-                gdh.MCHeader = TESNode+"Gen/Header"
-                gdh.CreateBeam = False
-                # Dummy SimInit to make GenToSim happy
-                # This will reset seeds but no simulation has yet been
-                # done so everyone is happy
-                sdh = SimInit('SplitSim')
-                sdh.GenHeader = "/Event/Gen/Header"  # Use the main gen header to get the event and run number
-                sdh.MCHeader = "Split/MC/Header"
-
-                simSlotSplit.Members += [ sdh]
-
-                simSlotSplitSeq = GaudiSequencer( "Make"+self.slotName(slot)+"SplitSim")
-                simSlotSplit.Members += [simSlotSplitSeq]
-
-                simSlotSplitSeq.RootInTES = 'Signal/Split'.format(slot)
-
-                genToSim = GenerationToSimulation( "GenToSim" + slot + 'Split',
-                                                LookForUnknownParticles = True )
-                # genToSim.SelectiveSimulationStep = 2
-                simSlotSplitSeq.Members += [ genToSim ]
-
-                simSlotSplitSeq.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot + 'Split' ) ]
-                simSlotSplitSeq.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot + 'Split' ) ]
-                simToMC = SimulationToMCTruth( "SimToMCTruth"+slot + 'Split' )
-                simSlotSplitSeq.Members += [ simToMC ]
-
-                detHits = GaudiSequencer( "DetectorsHits" + slot + 'Split' )
-                simSlotSplitSeq.Members += [ detHits ]
-                simSlotSplitSeq.Members += [ GaussRedecayPrintMCParticles('SplitPrint') ]
-
-                configuredRichSim = [ False ]
-                for det in self.getProp('DetectorSim')['Detectors']:
-                    self.configureDetectorSim( slot+'Split', detHits, det, configuredRichSim )
-
-                if self.getProp("PostSimFilters") :
-                    filterSeq = GaudiSequencer("PostSimFilterSeq")
-                    simSlotSplitSeq.Members += [ filterSeq ]
-                # ################################################
-                # Split part end
-                # ################################################
-
-                genToSim = GenerationToSimulation( "GenToSim" + slot + 'Signal',
-                                                LookForUnknownParticles = True )
-                simSlotSignalSeqImpl.Members += [ genToSim ]
-
-                simSlotSignalSeqImpl.Members += [ GiGaFlushAlgorithm( "GiGaFlush"+slot + 'Signal' ) ]
-                simSlotSignalSeqImpl.Members += [ GiGaCheckEventStatus( "GiGaCheckEvent"+slot + 'Signal' ) ]
-                simToMC = SimulationToMCTruth( "SimToMCTruth"+slot + 'Signal' )
-                simSlotSignalSeqImpl.Members += [ simToMC ]
-
-                detHits = GaudiSequencer( "DetectorsHits" + slot + 'Signal' )
-                simSlotSignalSeqImpl.Members += [ detHits ]
-                simSlotSignalSeqImpl.Members += [ GaussRedecayPrintMCParticles('SignalPrint') ]
-
-                configuredRichSim = [ False ]
-                for det in self.getProp('DetectorSim')['Detectors']:
-                    self.configureDetectorSim( slot+'Signal', detHits, det, configuredRichSim )
-
-                # Now merge the Split part back into the signal bit
-                mergeSlotSeq = GaudiSequencer( "Merge"+self.slotName(slot)+"SignalSplitSim")
-                GaussRedecayMergeAndClean('GaussRedecayMergeAndCleanSignal').SignalTESROOT = 'Split/'
-                GaussRedecayMergeAndClean('GaussRedecayMergeAndCleanSignal').GaussRedecay = svcname
-                mergeSlotSeq.Members += [
-                    GaussRedecayMergeAndClean('GaussRedecayMergeAndCleanSignal')]
-                simSlotSignalSeqImpl.Members += [mergeSlotSeq]
-
-            # ##############################################
-            # End signal part
-            # ##############################################
-            loadSlotSeq = GaudiSequencer( "Load"+self.slotName(slot)+"Sim", ModeOR=True )
-            grdfilter = GaussRedecayCtrFilter('CheckIfSignalSim2{}'.format(slot))
-            grdfilter.IsPhaseNotEqual = 2
-            loadSlotSeq.RootInTES = slot
-            loadSlotSeq.Members += [
-                grdfilter,
-                GaussRedecayRetrieveFromService('GaussRedecayRetrieveFromService{}'.format(slot))]
-            simSeq.Members += [loadSlotSeq]
-            if slot == '':
-                grdfilter = GaussRedecayCtrFilter('CheckIfMerge')
-                grdfilter.IsPhaseEqual = 0
-                mergeSlotSeq = GaudiSequencer( "Merge"+self.slotName(slot)+"Sim", ModeOR=True )
-                GaussRedecayMergeAndClean().MCHitsLocation = GaussRedecayCopyToService().MCHitsLocation
-                GaussRedecayMergeAndClean().MCCaloHitsLocation = GaussRedecayCopyToService().MCCaloHitsLocation
-                GaussRedecayMergeAndClean('GaussRedecayMergeAndCleanSignal').MCHitsLocation = GaussRedecayCopyToService().MCHitsLocation
-                GaussRedecayMergeAndClean('GaussRedecayMergeAndCleanSignal').MCCaloHitsLocation = GaussRedecayCopyToService().MCCaloHitsLocation
-                mergeSlotSeq.Members += [
-                    #StoreExplorerAlg('BeforeMerge'),
-                    grdfilter,
-                    GaussRedecayMergeAndClean()]
-                    #GaussRedecayPrintMCParticles('FullPrint'),
-                    #StoreExplorerAlg('AfterMerge')]
-                simSeq.Members += [mergeSlotSeq]
-                GaudiSequencer('RichHitsSignal').Members = GaudiSequencer('RichHitsSignal').Members[:4]
-            richpaddingSlotSeq = GaudiSequencer( "RichPadding"+self.slotName(slot) )
-            richpaddingSlotSeq.RootInTES = slot
-            richpaddingSlotSeq.Members = GaudiSequencer('RichHits' + slot).Members[4:]
-            GaudiSequencer('RichHits' + slot).Members = GaudiSequencer('RichHits' + slot).Members[:4]
-            simSeq.Members += [richpaddingSlotSeq]
-
-
-            # Data packing ...
-            if self.getProp("EnablePack") :
-                packing = GaudiSequencer(self.slotName(slot)+"EventDataPacking")
-                simSeq.Members += [ packing ]
-                SimConf().PackingSequencers[slot] = packing
+        self.defineOutput(crossingList)
diff --git a/Sim/Gauss/python/Gauss/Geometry/BCM.py b/Sim/Gauss/python/Gauss/Geometry/BCM.py
new file mode 100644
index 0000000000000000000000000000000000000000..2e63d159484f4bd96d2f378240df9586d36829f1
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/BCM.py
@@ -0,0 +1,32 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class BCM(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        from Gauss.Geometry import LHCbGeo
+        # Add the non-standard pieces of the BeforeMagnet region.
+        region = 'BeforeMagnetRegion'
+        if region in detPieces:
+            pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
+        # Add the entire Upstream region.
+        region = 'UpstreamRegion'
+        if region in detPieces:
+            detPieces[region] = []
+        LHCbGeo._listOfGeoObjects_.append("/dd/Structure/LHCb/" + region)
+        # Add the AfterMuon part of the Downstream region.
+        region = 'DownstreamRegion'
+        if region in detPieces:
+            pieces = ['AfterMuon']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
diff --git a/Sim/Gauss/python/Gauss/Geometry/BLS.py b/Sim/Gauss/python/Gauss/Geometry/BLS.py
new file mode 100644
index 0000000000000000000000000000000000000000..e5c66dd10a095e071a175bdd9b916af9fb6ea489
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/BLS.py
@@ -0,0 +1,30 @@
+
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class BCM(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        from Gauss.Geometry import LHCbGeo
+        # Add the non-standard pieces of the BeforeMagnet region.
+        region = 'BeforeMagnetRegion'
+        if region in detPieces:
+            pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
+        # Add the non-standard pieces of the Upstream region,
+        # unless the Upstream region has been added as a whole.
+        region = 'UpstreamRegion'
+        path = '/dd/Structure/LHCb/' + region
+        if region in detPieces and path not in LHCbGeo._listOfGeoObjects_:
+            pieces = ['BlockWallUpstr']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
diff --git a/Sim/Gauss/python/Gauss/Geometry/BeamPipe.py b/Sim/Gauss/python/Gauss/Geometry/BeamPipe.py
new file mode 100644
index 0000000000000000000000000000000000000000..1a9d2b04f66cf938eb5dfad83961f47d9a5e9bba
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/BeamPipe.py
@@ -0,0 +1,110 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry import LHCbGeo
+from Gaudi.Configuration import Configurable
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class BeamPipe(det_base):
+
+    __slots__ = {
+        "State": 'BeamPipeOn',
+    }
+
+    _beamPipeStates = ['beampipeon', 'beampipeoff', 'beampipeindet']
+    _beamPipeElements = {
+        "velo": [
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/"
+            "DownStreamWakeFieldCone",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamWakeFieldCone",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank"],
+        "rich1": [
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1BeforeSubM",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1SubMaster",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/PipeInRich1AfterSubM",
+            "/dd/Structure/LHCb/BeforeMagnetRegion/Rich1/Rich1BeamPipe"],
+        "tt": ["/dd/Structure/LHCb/BeforeMagnetRegion/TT/PipeInTT"],
+        "ut": ["/dd/Structure/LHCb/BeforeMagnetRegion/UT/PipeInUT"],
+        "magnet": [
+            "/dd/Structure/LHCb/MagnetRegion/PipeInMagnet",
+            "/dd/Structure/LHCb/MagnetRegion/PipeSupportsInMagnet"],
+        "AfterMagnetRegion": [
+            "/dd/Structure/LHCb/AfterMagnetRegion/PipeAfterT",
+            "/dd/Structure/LHCb/AfterMagnetRegion/PipeSupportsAfterMagnet"],
+        "t": ["/dd/Structure/LHCb/AfterMagnetRegion/T/PipeInT"],
+        "rich2": ["/dd/Structure/LHCb/AfterMagnetRegion/Rich2/Rich2BeamPipe"],
+        "downstreamregion": [
+            "/dd/Structure/LHCb/DownstreamRegion/PipeDownstream",
+            "/dd/Structure/LHCb/DownstreamRegion/PipeSupportsDownstream",
+            "/dd/Structure/LHCb/DownstreamRegion/PipeBakeoutDownstream"]}
+
+    @staticmethod
+    def removeBeamPipeElements(det):
+        det = det.lower()
+        # Remove beampipe elements in <det> - will be included automatically
+        if det in BeamPipe._beamPipeElements.keys():
+            for element in BeamPipe._beamPipeElements[det]:
+                # remove all instances of the element
+                while element in LHCbGeo._listOfGeoObjects_:
+                    LHCbGeo._listOfGeoObjects_.remove(element)
+
+    @staticmethod
+    def removeAllBeamPipeElements():
+        # Remove all beampipe elements
+        for det in BeamPipe._beamPipeElements.keys():
+            for element in BeamPipe._beamPipeElements[det]:
+                # remove all instances of the element
+                while element in LHCbGeo._listOfGeoObjects_:
+                    LHCbGeo._listOfGeoObjects_.remove(element)
+
+    def validateBeamPipeSwitch(self):
+        bpString = self.getProp("State")
+        bpLower = bpString.lower()
+        if bpLower not in self._beamPipeStates:
+            raise RuntimeError(
+                "ERROR: BeamPipe configuration '%s' not recognised!" %
+                bpString)
+
+    def __init__(self, name=Configurable.DefaultName, **kwargs):
+        kwargs["name"] = name
+        super(det_base, self).__init__(*(), **kwargs)
+        self.initialize()
+
+    def ApplyDetector(self, basePieces, detPieces):
+        # This function is only executed if BeamPipe was set to Active
+        self.validateBeamPipeSwitch()
+
+        if not "BeamPipeOn" == self.getProp("State"):
+            return
+        all_dets = LHCbGeo().getProp('DetectorGeo')['Detectors']
+        # Here commences a hack to deal with daft DDDB structure
+        ignoreList = ['ut', 'tt']
+        # decide if TT or UT in dets to simulate
+        ttDetectorList = [det for det in ['UT', 'TT'] if det in all_dets]
+        # lower strings
+        if ttDetectorList:
+            # lower everything in ttDetectorList
+            ttDetectorList = [det.lower() for det in ttDetectorList]
+            # get the elements to ignore
+            ignoreList = [
+                det
+                for det in ignoreList if det not in ttDetectorList]
+
+        for region in self._beamPipeElements.keys():
+            if region in ignoreList:
+                continue
+            for element in self._beamPipeElements[region]:
+                LHCbGeo._listOfGeoObjects_.append(element)
+
+        # Finally add in the TT or UT beampipe if we're not defining the
+        # detectors but want the BP anyway depending on DataType
+        # Nasty and unclean - change the DDDB s.t. it makes sense please!
+        if "UT" not in all_dets and "TT" not in all_dets:
+            from Configurables import LHCbApp
+            if LHCbApp().getProp("DataType") not in ["Upgrade"]:
+                for element in self._beamPipeElements["tt"]:
+                    LHCbGeo._listOfGeoObjects_.append(element)
+            else:
+                for element in self._beamPipeElements["ut"]:
+                    LHCbGeo._listOfGeoObjects_.append(element)
diff --git a/Sim/Gauss/python/Gauss/Geometry/CALO.py b/Sim/Gauss/python/Gauss/Geometry/CALO.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d160e55539f8934ce2fb638f6a9c5bf70ff45fd
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/CALO.py
@@ -0,0 +1,187 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+from Gauss.Utilities import GaussImportOptions
+from Gaussino.Utilities import run_once
+from GaudiKernel import SystemOfUnits
+
+
+@run_once
+def add_histos():
+    from Configurables import HistogramDataSvc
+    HistogramDataSvc().Input += [
+        "GaussCalo DATAFILE='$PARAMFILESROOT/data/gausscalo.root' TYP='ROOT'"]
+
+
+@subdetector
+class SPD(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("calo")
+        region = 'DownstreamRegion'
+        detPieces[region] += ['Spd']
+        detPieces[region] += ['Converter']
+
+    def SetupExtractionImpl(self, slot=''):
+        add_histos()
+        from Configurables import GetCaloHitsAlg
+        self.simconf_name = 'Spd'
+        det = "Spd"
+        GaussImportOptions("$GAUSSCALOROOT/options/GaussGeo-Spd.opts")
+        alg = GetCaloHitsAlg(
+            "Get"+det+"Hits"+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det+'/Hits'
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        if slot != '':
+            # Histograms are currently not split by SpillOver slot so skip
+            # for now
+            return
+        from Configurables import MCCaloMonitor
+        det = 'Spd'
+        moni = MCCaloMonitor(
+            det + "Monitor" + slot,
+            MCCaloHits='MC/'+det+'/Hits',
+            OutputLevel=4,
+            Detector='Spd',
+            Regions=True,
+            MaximumEnergy=10.*SystemOfUnits.MeV,
+            Threshold=1.5*SystemOfUnits.MeV
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
+
+
+@subdetector
+class PRS(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        region = 'DownstreamRegion'
+        detPieces[region] += ['Prs']
+
+    def SetupExtractionImpl(self, slot=''):
+        add_histos()
+        from Configurables import GetCaloHitsAlg
+        GaussImportOptions("$GAUSSCALOROOT/options/GaussGeo-Prs.opts")
+        self.simconf_name = 'Prs'
+        det = "Prs"
+        alg = GetCaloHitsAlg(
+            "Get"+det+"Hits"+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det+'/Hits'
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCCaloMonitor
+        if slot != '':
+            # Histograms are currently not split by SpillOver slot so skip
+            # for now
+            return
+        det = "Prs"
+        moni = MCCaloMonitor(
+            det + "Monitor" + slot,
+            MCCaloHits='MC/'+det+'/Hits',
+            OutputLevel=4,
+            Detector='Prs',
+            Regions=True,
+            MaximumEnergy=10.*SystemOfUnits.MeV,
+            Threshold=1.5*SystemOfUnits.MeV
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
+
+
+@subdetector
+class ECAL(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        region = 'DownstreamRegion'
+        detPieces[region] += ['Ecal']
+
+    def SetupExtractionImpl(self, slot=''):
+        add_histos()
+        from Configurables import GetCaloHitsAlg
+        GaussImportOptions("$GAUSSCALOROOT/options/GaussGeo-Ecal.opts")
+        self.simconf_name = 'Ecal'
+        det = "Ecal"
+        alg = GetCaloHitsAlg(
+            "Get"+det+"Hits"+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det+'/Hits'
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCCaloMonitor
+        if slot != '':
+            # Histograms are currently not split by SpillOver slot so skip
+            # for now
+            return
+        det = "Ecal"
+        moni = MCCaloMonitor(
+            det + "Monitor" + slot,
+            MCCaloHits='MC/'+det+'/Hits',
+            OutputLevel=4,
+            Detector=det,
+            Regions=True,
+            MaximumEnergy=1000.*SystemOfUnits.MeV,
+            Threshold=10.*SystemOfUnits.MeV
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
+
+
+@subdetector
+class HCAL(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        region = 'DownstreamRegion'
+        detPieces[region] += ['Hcal']
+
+    def SetupExtractionImpl(self, slot=''):
+        add_histos()
+        from Configurables import GetCaloHitsAlg
+        GaussImportOptions("$GAUSSCALOROOT/options/GaussGeo-Hcal.opts")
+        self.simconf_name = 'Hcal'
+        det = "Hcal"
+        alg = GetCaloHitsAlg(
+            "Get"+det+"Hits"+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det+'/Hits'
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCCaloMonitor
+        if slot != '':
+            # Histograms are currently not split by SpillOver slot so skip
+            # for now
+            return
+        det = "Hcal"
+        moni = MCCaloMonitor(
+            det + "Monitor" + slot,
+            MCCaloHits='MC/'+det+'/Hits',
+            OutputLevel=4,
+            Detector=det,
+            Regions=True,
+            MaximumEnergy=1000.*SystemOfUnits.MeV,
+            Threshold=5.*SystemOfUnits.MeV
+            )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/Configuration.py b/Sim/Gauss/python/Gauss/Geometry/Configuration.py
new file mode 100644
index 0000000000000000000000000000000000000000..a4d46fae438339f448940c9f8b331d9bb8898659
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/Configuration.py
@@ -0,0 +1,217 @@
+from Configurables import LHCbConfigurableUser
+from Gaudi.Configuration import Configurable
+from Gauss.Geometry.Helpers import checkIncompatibleDetectors
+from Gauss.Geometry.Helpers import defineGeoBasePieces
+
+
+class LHCbGeo(LHCbConfigurableUser):
+
+    """Main configurable to set up the LHCb geometry using the GaussGeo
+    service for Run1 or Run2"""
+
+    __knownDetectors__ = [
+        'velo', 'puveto', 'vp', 'tt', 'ut',
+        'it', 'sl', 'ot', 'ft', 'ft-noshield',
+        'rich',  'rich1', 'rich2', 'torch',
+        'calo',  'spd', 'prs', 'ecal', 'hcal',
+        'muon', 'magnet', 'rich1pmt', 'rich2pmt', 'hc'
+        ]
+
+    __slots__ = {
+        # Simple lists of sub detectors
+        "DetectorGeo": {
+            "Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2',
+                          'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet']},
+        "DetectorSim": {
+            "Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2',
+                          'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet']},
+        "DetectorMoni": {
+            "Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2',
+                          'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon']},
+        "Debug": False,
+        "SensDetMap":{},
+        "ExtraGeoTools":[]
+        }
+
+    _detectorsDefaults = {
+        "Detectors": ['PuVeto', 'Velo', 'TT', 'IT', 'OT', 'Rich1', 'Rich2',
+                      'Spd', 'Prs', 'Ecal', 'Hcal', 'Muon', 'Magnet']
+    }
+    _propertyDocDct = {
+        "DetectorGeo": """ Dictionary specifying the detectors to take
+                           into account in Geometry """,
+        "DetectorSim": """ Dictionary specifying the detectors
+                            to simulated (should be in geometry): """,
+        "DetectorMoni": """ Dictionary specifying the detectors
+                             to monitor (should be simulated) :"""
+    }
+
+    TrackingSystem = ['VELO', 'TT', 'IT', 'OT']
+    PIDSystem = ['RICH', 'CALO', 'MUON']
+
+    # List of geometry objects which will be converted, it's content is used in
+    # GaussGeo or in GiGaInputStream if GiGaGeo is used for conversion
+    _listOfGeoObjects_ = []
+
+    def __init__(self, name=Configurable.DefaultName, **kwargs):
+        kwargs["name"] = name
+        super(LHCbConfigurableUser, self).__init__(*(), **kwargs)
+        self.initialize()
+
+    def defineStreamItemsGeo(self, basePieces, detPieces):
+        for region in basePieces.keys():
+            path = "/dd/Structure/LHCb/"+region+"/"
+            if len(detPieces[region]) == 0:
+                continue
+            # This should preserve order
+            for element in basePieces[region] + detPieces[region]:
+                myStreamItem = path + element
+                if myStreamItem not in self._listOfGeoObjects_:
+                    self._listOfGeoObjects_.append(myStreamItem)
+
+    def __apply_configuration__(self):
+        pass
+
+    def apply(self):
+        from Configurables import GaussGeo
+        if self.getProp('Debug'):
+            GaussGeo.OutputLevel = -10
+
+        detPieces = {'BeforeUpstreamRegion': [],
+                     'UpstreamRegion': [],
+                     'BeforeMagnetRegion': [],
+                     'MagnetRegion': [],
+                     'AfterMagnetRegion': [],
+                     'DownstreamRegion': [],
+                     'AfterDownstreamRegion': []}
+        basePieces = {}
+
+        checkIncompatibleDetectors()
+        defineGeoBasePieces(basePieces)
+
+        gaussgeo = GaussGeo()
+
+        # Use information from SIMCOND and GeometryInfo
+        # Allows to be set to False by RichXPmt
+        gaussgeo.UseAlignment = True
+        gaussgeo.AlignAllDetectors = True
+
+        from Gauss.Geometry.Helpers import getsubdetector
+        detectors_geo = self.getProp("DetectorGeo")["Detectors"]
+        detectors_sim = self.getProp("DetectorSim")["Detectors"]
+        detectors_moni = self.getProp("DetectorMoni")["Detectors"]
+        # Initial loop to mark all used detectors as active
+        for det in detectors_geo:
+            getsubdetector(det).Active = True
+        for det in detectors_sim:
+            getsubdetector(det).Simulate = True
+        for det in detectors_moni:
+            getsubdetector(det).Monitor = True
+
+        # BeamPipe
+        getsubdetector('BeamPipe').ApplyDetector(basePieces, detPieces)
+
+        for det in detectors_geo:
+            getsubdetector(det).ApplyDetector(basePieces, detPieces)
+
+        # Now convert all basePieces entries to fill list of geo objects
+        self.defineStreamItemsGeo(basePieces, detPieces)
+
+        # FIXME: does basically the same as before, but was done this way in
+        # the main Gauss configuration. Should rethink
+        for det in detectors_geo:
+            getsubdetector(det).ApplyStream()
+
+        getsubdetector("Magnet").defineMagnetGeoField()
+
+        # FIXME: those calo option files
+        # Seperate Calo opts
+        # Returns a list containing all the elments common to both lists
+        # if self.getProp('UseGaussGeo'):
+        # if [det for det in ['Spd', 'Prs', 'Ecal', 'Hcal'] if det in
+        # self.getProp('DetectorGeo')['Detectors']]:  # NOQA
+        # importOptions("$GAUSSCALOROOT/options/GaussGeo-Calo.py")
+        # else:
+        # if [det for det in ['Spd', 'Prs', 'Ecal', 'Hcal'] if det in
+        # self.getProp('DetectorGeo')['Detectors']]:  # NOQA
+        # importOptions("$GAUSSCALOROOT/options/Calo.opts")
+
+        self.PrintDebugDump(detPieces, basePieces)
+
+        # No BP requested - therefore remove all elements from Geo.StreamItems
+        if ("BeamPipeOff" == getsubdetector('BeamPipe').getProp("State")):
+            from Gauss.Geometry.BeamPipe import BeamPipe
+            BeamPipe.removeAllBeamPipeElements()
+
+        # Populate the list of geometry elements
+        # in the requested conversion service
+        for el in self._listOfGeoObjects_:
+            gaussgeo.GeoItemsNames.append(el)
+
+        self.MakeItTalkToGaussino()
+
+        # Setup read-out algorithms
+        for det in detectors_sim:
+            getsubdetector(det).SetupExtraction()
+
+        for det in detectors_moni:
+            getsubdetector(det).SetupMonitor()
+
+    def MakeItTalkToGaussino(self):
+        from Configurables import GiGaMTDetectorConstructionFAC
+        from Configurables import GiGaMT
+        giga = GiGaMT()
+        giga.DetectorConstruction = "GiGaMTDetectorConstructionFAC"
+        dettool = giga.addTool(GiGaMTDetectorConstructionFAC,
+                               "GiGaMTDetectorConstructionFAC")
+        dettool.GiGaMTGeoSvc = "GaussGeo"
+        dettool.SensDetVolumeMap = self.getProp('SensDetMap')
+
+        dettool.AfterGeoConstructionTools = self.getProp('ExtraGeoTools')
+
+        # Now add the tools automatically set up after the construction
+        # of the geometry to configure the regions
+        dettool.AfterGeoConstructionTools += [
+            'GiGaSetSimAttributes',
+            'GiGaRegionsTool']
+        from Configurables import GiGaSetSimAttributes
+        dettool.addTool(GiGaSetSimAttributes(), name="GiGaSetSimAttributes")
+        dettool.GiGaSetSimAttributes.OutputLevel = 4
+        from Configurables import GiGaRegionsTool
+        dettool.addTool(GiGaRegionsTool(), name="GiGaRegionsTool")
+        dettool.GiGaRegionsTool.OutputLevel = 4
+        # FIXME: This is all just temporary, especially the provided xml is only
+        # for Run1+2 MC
+        from Configurables import RegionsDefinitionSvc
+        svc = RegionsDefinitionSvc()
+        xmlfile = "$GAUSSROOT/xml/SimulationRICHAerogelOff.xml"
+        svc.RegionsDefinitionDbLocation = xmlfile
+
+    def PrintDebugDump(self, detPieces, basePieces):
+        if self.getProp("Debug"):
+            print "\nDEBUG Detector Geometry Elements:"
+            print "\nkey : detPieces[key]"
+            for key in detPieces.keys():
+                print "%s : %s" % (key, detPieces[key])
+            print "\nkey : detPieces[key]"
+
+            for key in sorted(detPieces.keys()):
+                print "%s : %s" % (key, detPieces[key])
+
+            print "\nkey : basePieces[key]"
+            for key in basePieces.keys():
+                print "%s : %s" % (key, basePieces[key])
+
+            print "\nkey : Sorted basePieces[key]"
+            for key in sorted(basePieces.keys()):
+                print "%s : %s" % (key, basePieces[key])
+
+            print "\ngeo items:"
+            for item in self._listOfGeoObjects_:
+                print "%s" % (item)
+
+            print "\ngeo items SORTED:"
+            mySortedGeoStream = self._listOfGeoObjects_[:]
+            mySortedGeoStream.sort()
+            for item in mySortedGeoStream:
+                print "%s" % (item)
diff --git a/Sim/Gauss/python/Gauss/Geometry/FT.py b/Sim/Gauss/python/Gauss/Geometry/FT.py
new file mode 100644
index 0000000000000000000000000000000000000000..c59eb9a7f6065a4f9297ad88c943bf1962e6e132
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/FT.py
@@ -0,0 +1,54 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class FT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("t")
+        region = "AfterMagnetRegion"
+        if 'T' not in detPieces[region]:
+            detPieces[region] += ['T/FT']
+        if 'T/PipeInT' not in detPieces[region]:
+            detPieces[region] += ['T/PipeInT']
+        region = "DownstreamRegion"
+        detPieces[region] += ['NeutronShielding']
+
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'FT'
+        region   = "AfterMagnetRegion/T"
+        det = "FT"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+        myZStations = [
+            7938.0*SystemOfUnits.mm,
+            8625.0*SystemOfUnits.mm,
+            9315.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 100.*SystemOfUnits.cm
+        myZStationYMax = 100.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "FTHitMonitor"+slot,
+            mcPathString="MC/FT/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/HC.py b/Sim/Gauss/python/Gauss/Geometry/HC.py
new file mode 100644
index 0000000000000000000000000000000000000000..ce875bc735e93b7b8ee17a10b7eb483bf4b241da
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/HC.py
@@ -0,0 +1,46 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gaudi.Configuration import log
+from GaudiKernel import SystemOfUnits
+
+
+@subdetector
+class HC(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        from Gauss.Geometry import LHCbGeo
+        from Configurables import LHCbApp
+        year = LHCbApp().getProp("DataType")
+        if year not in self.Run2DataTypes:
+            log.warning("Check your options: you have asked"
+                        "to simulate Herschel but not in %s." % year)
+            log.warning("Simulating only the LHC tunnel.")
+        # Add the non-standard pieces of the BeforeMagnet region.
+        region = 'BeforeMagnetRegion'
+        if region in detPieces:
+            pieces = ['PipeJunctionBeforeVelo', 'BeforeVelo']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
+        # Add the AfterMuon part of the Downstream region.
+        region = 'DownstreamRegion'
+        if region in detPieces:
+            pieces = ['AfterMuon']
+            for piece in pieces:
+                if piece in detPieces[region]:
+                    continue
+                detPieces[region] += [piece]
+        # Add the entire Upstream, BeforeUpstream, and AfterDownstream regions.
+        regions = ['UpstreamRegion', 'BeforeUpstreamRegion',
+                   'AfterDownstreamRegion']
+        for region in regions:
+            if region in detPieces:
+                detPieces[region] = []
+            LHCbGeo._listOfGeoObjects_.append("/dd/Structure/LHCb/" + region)
+
+        # Extend the world volume.
+        from Configurables import GaussGeo
+        GaussGeo().ZsizeOfWorldVolume = 300.0 * SystemOfUnits.m
diff --git a/Sim/Gauss/python/Gauss/Geometry/Helpers.py b/Sim/Gauss/python/Gauss/Geometry/Helpers.py
new file mode 100644
index 0000000000000000000000000000000000000000..f29b746c9c5c1c94814b4833988f6f94068080f8
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/Helpers.py
@@ -0,0 +1,54 @@
+__subdetector_configurables = {}
+
+
+def subdetector(obj):
+    lname = obj.__name__.lower()
+    if lname in __subdetector_configurables:
+        raise RuntimeError("Class definition conflict found")
+    __subdetector_configurables[lname] = obj
+    obj.name = lname
+    return obj
+
+
+def getsubdetector(name):
+    lname = name.lower()
+    if lname not in __subdetector_configurables:
+        raise RuntimeError("Class definition not found: {}".format(name))
+    return __subdetector_configurables[lname]()
+
+
+def checkIncompatibleDetectors():
+    from Gauss.Geometry import LHCbGeo
+    _incompatibleDetectors = {
+        "Velo": ["Velo", "VP"],
+        "VeloPuVeto": ["PuVeto", "VP"],
+        "TT": ["TT", "UT"],
+        "Muon": ["Muon", "MuonNoM1"],
+        "MuonTorch": ["Muon", "Torch"]
+    }
+    for section in _incompatibleDetectors.keys():
+        incompatList = _incompatibleDetectors[section]
+        used_dets = LHCbGeo().getProp("DetectorGeo")['Detectors']
+        myList = [det for det in used_dets if det in incompatList]
+        if len(myList) > 1:
+            raise RuntimeError(
+                "Incompatible detectors: %s in %s section." %
+                (myList, section))
+
+
+def defineGeoBasePieces(basePieces):
+    basePieces['BeforeUpstreamRegion']  = []
+    basePieces['UpstreamRegion']        = []
+    basePieces['BeforeMagnetRegion']    = []
+    basePieces['MagnetRegion']          = []
+    basePieces['AfterMagnetRegion']     = []
+    basePieces['DownstreamRegion']      = []
+    basePieces['AfterDownstreamRegion'] = []
+
+
+__all__ = [
+    'checkIncompatibleDetectors',
+    'getsubdetector',
+    'subdetector',
+    'defineGeoBasePieces'
+]
diff --git a/Sim/Gauss/python/Gauss/Geometry/IT.py b/Sim/Gauss/python/Gauss/Geometry/IT.py
new file mode 100644
index 0000000000000000000000000000000000000000..26bf6d8b6732deb83f3392eca86edc275382748c
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/IT.py
@@ -0,0 +1,51 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class IT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("t")
+        region = "AfterMagnetRegion"
+        if 'T' not in detPieces[region]:
+            detPieces[region] += ['T/IT']
+        if 'T/PipeInT' not in detPieces[region]:
+            detPieces[region] += ['T/PipeInT']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'IT'
+        region = "AfterMagnetRegion/T"
+        det = "IT"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+        myZStations = [
+            7780.0*SystemOfUnits.mm,
+            8460.0*SystemOfUnits.mm,
+            9115.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 150.*SystemOfUnits.cm
+        myZStationYMax = 150.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "ITHitMonitor"+slot,
+            mcPathString="MC/IT/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/Magnet.py b/Sim/Gauss/python/Gauss/Geometry/Magnet.py
new file mode 100644
index 0000000000000000000000000000000000000000..7be7dc264574842c459882c73234981619b635c0
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/Magnet.py
@@ -0,0 +1,43 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class Magnet(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        detPieces["MagnetRegion"] = ['Magnet', 'BcmDown']
+
+    def defineMagnetGeoField(self):
+        from Configurables import GaussGeo, ToolFieldMgr, MagFieldFromSvc
+        from Gauss.Geometry.Helpers import getsubdetector
+        # Only bother with the FIELD Geometry if simulated.
+        if getsubdetector("Magnet").Simulate or getsubdetector("HC").Simulate:
+            GaussGeo().FieldManager = "ToolFieldMgr/FieldMgr"
+            GaussGeo().addTool(ToolFieldMgr("FieldMgr"), name="FieldMgr")
+            GaussGeo().FieldMgr.Stepper = "G4ClassicalRK4"
+            GaussGeo().FieldMgr.MagneticField = "MagFieldFromSvc/LHCbField"
+            GaussGeo().FieldMgr.addTool(MagFieldFromSvc("LHCbField"), name="LHCbField")  # NOQA
+            GaussGeo().FieldMgr.LHCbField.MagneticFieldService = "MagneticFieldSvc"  # NOQA
+
+        if getsubdetector("HC").Simulate:
+            from Configurables import MagneticFieldSvc, MultipleMagneticFieldSvc
+            # Use MultipleMagneticFieldSvc instead of default MagneticFieldSvc.
+            GaussGeo().FieldMgr.LHCbField.MagneticFieldService = "MultipleMagneticFieldSvc"  # NOQA
+            # Add LHCb dipole magnet and compensators.
+            if getsubdetector("Magnet").Simulate:
+              MultipleMagneticFieldSvc().MagneticFieldServices += ["MagneticFieldSvc"]
+              importOptions("$MAGNETROOT/options/UseCompensators.py")
+            # Import LSS fields.
+            importOptions("$MAGNETROOT/options/UseTripletLeft.py")
+            importOptions("$MAGNETROOT/options/UseTripletRight.py")
+            # Scale dipoles and quadrupoles.
+            scalableMagnets = ["Q1", "Q2", "Q3", "D1", "MCBX"]
+            magnets = MultipleMagneticFieldSvc().getProp("MagneticFieldServices")
+            scale =  self.getProp("BeamMomentum") / (3.5 * SystemOfUnits.TeV )
+            for magnet in magnets:
+              if any(m in magnet for m in scalableMagnets):
+                 MagneticFieldSvc(magnet).ForcedSignedCurrentScaling = scale
+                 print "Scaling", magnet, "by", scale
diff --git a/Sim/Gauss/python/Gauss/Geometry/Muon.py b/Sim/Gauss/python/Gauss/Geometry/Muon.py
new file mode 100644
index 0000000000000000000000000000000000000000..5091ba609cd536bc177fd4e8350d1e9cc1e8898c
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/Muon.py
@@ -0,0 +1,31 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class Muon(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        region = 'DownstreamRegion'
+        detPieces[region] += ['Muon']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'Muon'
+        det = "Muon"
+        alg = GetTrackerHitsAlg(
+            "Get"+det+"Hits"+slot,
+            MCHitsLocation='MC/' + det + '/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/DownstreamRegion/'+det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MuonHitChecker
+        moni = MuonHitChecker("MuonHitChecker"+slot, FullDetail=True)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/OT.py b/Sim/Gauss/python/Gauss/Geometry/OT.py
new file mode 100644
index 0000000000000000000000000000000000000000..f35efce0087cd8ceaca0ab932c9a5660079bf6a1
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/OT.py
@@ -0,0 +1,52 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class OT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("t")
+        region = "AfterMagnetRegion"
+        if 'T' not in detPieces[region]:
+            detPieces[region] += ['T/OT']
+        if 'T/PipeInT' not in detPieces[region]:
+            detPieces[region] += ['T/PipeInT']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'OT'
+        region = "AfterMagnetRegion/T"
+        det = "OT"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+
+        myZStations = [
+            7938.0*SystemOfUnits.mm,
+            8625.0*SystemOfUnits.mm,
+            9315.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 100.*SystemOfUnits.cm
+        myZStationYMax = 100.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "OTHitMonitor"+slot,
+            mcPathString="MC/OT/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/PuVeto.py b/Sim/Gauss/python/Gauss/Geometry/PuVeto.py
new file mode 100644
index 0000000000000000000000000000000000000000..6842c675e42ae00d15fc205dce9a5186c11971b0
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/PuVeto.py
@@ -0,0 +1,26 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector, getsubdetector
+
+
+@subdetector
+class PuVeto(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        pass
+
+    def SetupExtractionImpl(self, slot=''):
+        self.simconf_name = 'PuVeto'
+        det = "PuVeto"
+        region = "BeforeMagnetRegion"
+        from Configurables import GetTrackerHitsAlg
+        if not getsubdetector('VP').Active:
+            hits = GetTrackerHitsAlg(
+                'Get' + det + 'Hits' + slot,
+                MCHitsLocation='MC/'+det+'/Hits',
+                CollectionName='VeloPuSDet/Hits',
+                Detectors=['/dd/Structure/LHCb/' + region + '/Velo']
+                )
+            from Configurables import ApplicationMgr
+            ApplicationMgr().TopAlg += [hits]
diff --git a/Sim/Gauss/python/Gauss/Geometry/RICH.py b/Sim/Gauss/python/Gauss/Geometry/RICH.py
new file mode 100644
index 0000000000000000000000000000000000000000..8beee2e76226caf69590913f52d7c0c4707802cf
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/RICH.py
@@ -0,0 +1,73 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class RICH1(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("rich1")
+        detPieces['BeforeMagnetRegion'] += ['Rich1']
+
+    def ApplyStream(self):
+        from Gauss.Geometry import LHCbGeo
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/BeforeMagnetRegion/Rich1/Rich1Surfaces")
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/BeforeMagnetRegion/Rich1/RichHPDSurfaces")
+
+
+@subdetector
+class RICH2(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("rich2")
+        detPieces['AfterMagnetRegion'] += ['Rich2']
+
+    def ApplyStream(self):
+        from Gauss.Geometry import LHCbGeo
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/AfterMagnetRegion/Rich2/Rich2Surfaces")
+
+
+@subdetector
+class RICH1PMT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("rich1")
+        detPieces['BeforeMagnetRegion'] += ['Rich1']
+
+    def ApplyStream(self):
+        from Configurables import GaussGeo
+        from Gauss.Geometry import LHCbGeo
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/BeforeMagnetRegion/Rich1/Rich1Surfaces")
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/BeforeMagnetRegion/Rich1/RichPMTSurfaces")
+        GaussGeo().UseAlignment = False
+        GaussGeo().AlignAllDetectors = False
+
+
+@subdetector
+class RICH2PMT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("rich2")
+        detPieces['AfterMagnetRegion'] += ['Rich2']
+
+    def ApplyStream(self):
+        from Configurables import GaussGeo
+        from Gauss.Geometry import LHCbGeo
+        LHCbGeo._listOfGeoObjects_.append(
+            "/dd/Geometry/AfterMagnetRegion/Rich2/Rich2Surfaces")
+        GaussGeo().UseAlignment = False
+        GaussGeo().AlignAllDetectors = False
diff --git a/Sim/Gauss/python/Gauss/Geometry/SL.py b/Sim/Gauss/python/Gauss/Geometry/SL.py
new file mode 100644
index 0000000000000000000000000000000000000000..5a1b0295084c13260fbd4fe437404cd4aad1a141
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/SL.py
@@ -0,0 +1,36 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class SL(det_base):
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("t")
+        region = "AfterMagnetRegion"
+        if 'T' not in detPieces[region]:
+            detPieces[region] += ['T/SL']
+        # PSZ - line below might need to go depending on SL definition
+        if 'T/PipeInT' not in detPieces[region]:
+            detPieces[region] += ['T/PipeInT']
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+        myZStations = [
+            7780.0*SystemOfUnits.mm,
+            #8460.0*SystemOfUnits.mm,
+            9115.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 150.*SystemOfUnits.cm
+        myZStationYMax = 150.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "SLHitMonitor"+slot,
+            mcPathString="MC/SL/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/TT.py b/Sim/Gauss/python/Gauss/Geometry/TT.py
new file mode 100644
index 0000000000000000000000000000000000000000..d9c955561a35a60de0215c4ac673e5e6f895b0e6
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/TT.py
@@ -0,0 +1,47 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class TT(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("tt")
+        if 'TT' not in detPieces['BeforeMagnetRegion']:
+            detPieces['BeforeMagnetRegion'] += ['TT']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'TT'
+        region = "BeforeMagnetRegion"
+        det = "TT"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+        myZStations = [
+            2350.0*SystemOfUnits.mm,
+            2620.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 150.*SystemOfUnits.cm
+        myZStationYMax = 150.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "TTHitMonitor"+slot,
+            mcPathString="MC/TT/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/UT.py b/Sim/Gauss/python/Gauss/Geometry/UT.py
new file mode 100644
index 0000000000000000000000000000000000000000..229edd8afd424ec173d63f74d094a390b9d4c89c
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/UT.py
@@ -0,0 +1,45 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class UT(det_base):
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("ut")
+        if 'UT' not in detPieces['BeforeMagnetRegion']:
+            detPieces['BeforeMagnetRegion'] += ['UT']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'UT'
+        region = "BeforeMagnetRegion"
+        det = "UT"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import MCHitMonitor
+        from GaudiKernel import SystemOfUnits
+        myZStations = [
+            2350.0*SystemOfUnits.mm,
+            2620.0*SystemOfUnits.mm
+            ]
+        myZStationXMax = 150.*SystemOfUnits.cm
+        myZStationYMax = 150.*SystemOfUnits.cm
+
+        moni = MCHitMonitor(
+            "UTHitMonitor"+slot,
+            mcPathString="MC/UT/Hits",
+            zStations=myZStations,
+            xMax=myZStationXMax,
+            yMax=myZStationYMax)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/VP.py b/Sim/Gauss/python/Gauss/Geometry/VP.py
new file mode 100644
index 0000000000000000000000000000000000000000..e9689d68b084a301588cd01aa41da034af9bc3f6
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/VP.py
@@ -0,0 +1,32 @@
+from Gauss.Geometry.det_base import det_base
+from Gauss.Geometry.Helpers import subdetector
+from Gauss.Geometry.BeamPipe import BeamPipe
+
+
+@subdetector
+class VP(det_base):
+
+    __slots__ = {}
+
+    def ApplyDetector(self, basePieces, detPieces):
+        BeamPipe.removeBeamPipeElements("velo")
+        if 'BeforeMagnetRegion' in detPieces:
+            detPieces['BeforeMagnetRegion'] += ['VP']
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'VP'
+        region = "BeforeMagnetRegion"
+        det = "VP"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Gaudi.Configuration import log
+        log.warning("Monitoring for VP not available yet")
diff --git a/Sim/Gauss/python/Gauss/Geometry/Velo.py b/Sim/Gauss/python/Gauss/Geometry/Velo.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb153ccce6fcfd84f4ed88b89e7fa5d3c9a87035
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/Velo.py
@@ -0,0 +1,162 @@
+from Gauss.Geometry.det_base import det_base
+from Gaudi.Configuration import log
+from Gaudi.Configuration import Configurable
+from Gauss.Geometry.Helpers import subdetector
+
+
+@subdetector
+class Velo(det_base):
+
+    __slots__ = {
+        "State": 'BeamPipeOn',
+    }
+
+    def __init__(self, name=Configurable.DefaultName, **kwargs):
+        kwargs["name"] = name
+        super(det_base, self).__init__(*(), **kwargs)
+        self.initialize()
+
+    @staticmethod
+    def checkVeloDDDB():
+        """
+        Check if the Velo geometry is compatible with the chosen tags
+        """
+        from Configurables import LHCbApp
+        from DetCond.Configuration import CondDB
+        # set validity limits for  Velo geometry
+        # first postMC09 Velo geometry
+        GTagLimit1 = "head-20091120"
+        GTagLimit1 = GTagLimit1.split('-')[1].strip()
+        VeloLTagLimit1 = "velo-20091116"
+        VeloLTagLimit1 = VeloLTagLimit1.split('-')[1].strip()
+        # Thomas L. Velo geometry
+        GTagLimit2 = "head-20100119"
+        GTagLimit2 = GTagLimit2.split('-')[1].strip()
+        VeloLTagLimit2 = "velo-20100114"
+        VeloLTagLimit2 = VeloLTagLimit2.split('-')[1].strip()
+
+        # DDDB global tag used
+        DDDBDate = LHCbApp().DDDBtag
+        DDDBDate = DDDBDate.split('-')
+
+        # Check if DDDB tag has a regular format
+        # (instead of e.g. a user git branch)
+        if len(DDDBDate) > 1:
+            DDDBDate = DDDBDate[1].strip()
+            if DDDBDate.isdigit():
+                # check if/which local tag is used for Velo
+                cdb = CondDB()
+                cdbVeloDate = 0
+                for p in cdb.LocalTags:
+                    if p == "DDDB":
+                        taglist = list(cdb.LocalTags[p])
+                        for ltag in taglist:
+                            if ltag.find("velo") != -1:
+                                cdbVeloDate = ltag.split('-')[1].strip()
+
+                # Put this here rather than as an argument
+                VeloPostMC09 = 0
+                # check if the selected tags require
+                # one of the postMC09 Velo geometries
+                if (DDDBDate >= GTagLimit1) or (cdbVeloDate >= VeloLTagLimit1):
+                    VeloPostMC09 = 1
+                if (DDDBDate >= GTagLimit2) or (cdbVeloDate >= VeloLTagLimit2):
+                    VeloPostMC09 = 2
+
+                return VeloPostMC09
+
+        log.warning("DDDB tag not parsable as date. "
+                    "Using post-MC09 velo geometry : %s" % (DDDBDate))
+        return 2
+
+    def veloMisAlignGeometry(self, VeloPostMC09):
+
+        """
+        File containing the list of detector element to explicitely set
+        to have misalignement in the VELO.
+        """
+        # remove Automatically included detector elements
+        from Gauss.Geometry.BeamPipe import BeamPipe
+        BeamPipe.removeBeamPipeElements("velo")
+
+        from Gauss.Geometry import LHCbGeo
+        go = LHCbGeo._listOfGeoObjects_
+
+        if "/dd/Structure/LHCb/BeforeMagnetRegion/Velo" in go:
+            go.remove(
+                "/dd/Structure/LHCb/BeforeMagnetRegion/Velo")
+
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModulePU00"]
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModulePU02"]
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ModulePU01"]  # NOQA
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ModulePU03"]  # NOQA
+
+        txt = "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ModuleXX"
+        import math
+        for i in range(42):
+            nr = str(i)
+            if len(nr) == 1:
+                nr = '0'+str(i)
+            temp1 = txt.replace('XX', nr)
+            if math.modf(float(nr)/2.)[0] > 0.1:
+                temp1 = temp1.replace('Left', 'Right')
+            go += [temp1]
+
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownStreamWakeFieldCone"]  # NOQA
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamWakeFieldCone"]  # NOQA
+        if VeloPostMC09 == 1:
+            # description postMC09 of Velo (head-20091120),
+            # problem with Velo Tank simulation
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank"]
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections"]  # NOQA
+            go += [ "/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpstreamPipeSections"]  # NOQA
+        elif VeloPostMC09 == 2:
+            # Thomas L. newer description postMC09 of Velo
+            # --- Velo Right
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/RFBoxRight"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/DetSupportRight"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/ConstSysRight"]  # NOQA
+            # --- Velo Left
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/RFBoxLeft"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/DetSupportLeft"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/ConstSysLeft"]  # NOQA
+            # --- Velo
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownstreamPipeSections"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpstreamPipeSections"]  # NOQA
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VacTank"]
+        else:
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/UpStreamVacTank"]
+            go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/DownStreamVacTank"]  # NOQA
+
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloRight/RFFoilRight"]  # NOQA
+        go += ["/dd/Structure/LHCb/BeforeMagnetRegion/Velo/VeloLeft/RFFoilLeft"]
+
+    def ApplyDetector(self, basePieces, detPieces):
+        VeloP = Velo.checkVeloDDDB()
+        if VeloP == 1 or VeloP == 2:
+            basePieces['BeforeMagnetRegion'] = []
+
+        # Also sort out mis-alignment
+        VeloP = Velo.checkVeloDDDB()
+        # No need to misalign if only PuVeto exits - check me PSZ.
+        self.veloMisAlignGeometry(VeloP)  # To misalign VELO
+
+    def SetupExtractionImpl(self, slot=''):
+        from Configurables import GetTrackerHitsAlg
+        self.simconf_name = 'Velo'
+        region = "BeforeMagnetRegion"
+        det = "Velo"
+        alg = GetTrackerHitsAlg(
+            'Get'+det+'Hits'+slot,
+            MCHitsLocation='MC/'+det+'/Hits',
+            CollectionName=det + 'SDet/Hits',
+            Detectors=['/dd/Structure/LHCb/' + region + '/' + det]
+        )
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [alg]
+
+    def SetupMonitor(self, slot=''):
+        from Configurables import VeloGaussMoni
+        moni = VeloGaussMoni("VeloGaussMoni"+slot)
+        from Configurables import ApplicationMgr
+        ApplicationMgr().TopAlg += [moni]
diff --git a/Sim/Gauss/python/Gauss/Geometry/__init__.py b/Sim/Gauss/python/Gauss/Geometry/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d1ef0029ac71273541d0cfaeab06e81f0e25783
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/__init__.py
@@ -0,0 +1,20 @@
+from Gauss.Geometry.Configuration import LHCbGeo
+from Gauss.Geometry.BeamPipe import BeamPipe
+from Gauss.Geometry.Velo import Velo
+from Gauss.Geometry.PuVeto import PuVeto
+from Gauss.Geometry.CALO import *
+from Gauss.Geometry.RICH import *
+from Gauss.Geometry.Velo import *
+from Gauss.Geometry.VP import *
+from Gauss.Geometry.FT import *
+from Gauss.Geometry.TT import *
+from Gauss.Geometry.OT import *
+from Gauss.Geometry.IT import *
+from Gauss.Geometry.UT import *
+from Gauss.Geometry.Magnet import *
+from Gauss.Geometry.Muon import *
+from Gauss.Geometry.HC import *
+
+__all__ = [
+    'LHCbGeo', 'BeamPipe'
+]
diff --git a/Sim/Gauss/python/Gauss/Geometry/det_base.py b/Sim/Gauss/python/Gauss/Geometry/det_base.py
new file mode 100644
index 0000000000000000000000000000000000000000..d6dc291e0f49867e646f8dcf1d649e477299228c
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Geometry/det_base.py
@@ -0,0 +1,79 @@
+from Configurables import LHCbConfigurableUser
+from Gaudi.Configuration import Configurable
+
+
+class det_base(LHCbConfigurableUser):
+
+    """Base class for all subdetector configurables. These configurables should
+    not instantiate everything during the apply configuration call to allow
+    for a more fine-grained activation. Maybe ..."""
+
+    __slots__ = {
+        "active": False,
+        "simulate": False,
+        "monitor": False,
+        "simconf_name": 'NONE',
+    }
+
+    @property
+    def Active(self):
+        return self.getProp('active')
+
+    @property
+    def Simulate(self):
+        return self.getProp('simulate')
+
+    @property
+    def Monitor(self):
+        return self.getProp('monitor')
+
+    @Active.setter
+    def Active(self, value):
+        self.active = value
+
+    @Simulate.setter
+    def Simulate(self, value):
+        if not self.Active:
+            raise RuntimeError(
+                "Setting {} to be simulated but not active".format(self.name()))
+        self.simulate = value
+
+    @Monitor.setter
+    def Monitor(self, value):
+        if not self.Active or not self.Simulate:
+            raise RuntimeError(
+                "Setting {} to be monitored but not active"
+                "or simulated".format(self.name()))
+        self.monitor = value
+
+    def __init__(self, name=Configurable.DefaultName, **kwargs):
+        kwargs["name"] = name
+        apply(super(LHCbConfigurableUser, self).__init__, (), kwargs)
+        self.initialize()
+
+    def __apply_configuration__(self):
+        if self.getProp("Active"):
+            self.impl_configuration()
+
+    def impl_configuration(self):
+        pass
+
+    def ApplyDetector(self, basePieces, detPieces):
+        pass
+
+    def ApplyStream(self):
+        pass
+
+    def SetupExtraction(self, slot=''):
+        from Configurables import SimConf
+        self.SetupExtractionImpl(slot)
+        detlist = SimConf().getProp('Detectors')
+        n = self.getProp('simconf_name')
+        if n != 'NONE' and n not in detlist:
+            detlist += [n]
+
+    def SetupExtractionImpl(self, slot=''):
+        pass
+
+    def SetupMonitor(self, slot=''):
+        pass
diff --git a/Sim/Gauss/python/Gauss/Physics.py b/Sim/Gauss/python/Gauss/Physics.py
new file mode 100644
index 0000000000000000000000000000000000000000..2b425796b4e0675866a4e0d6884d9f0c93d5f734
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Physics.py
@@ -0,0 +1,199 @@
+from Gaudi.Configuration import log
+from Configurables import LHCbConfigurableUser
+from GaudiKernel import SystemOfUnits
+
+
+def gef(name):
+    import Configurables
+    return getattr(Configurables, "GiGaMT_%s" % name)
+
+
+def addConstructor(pl, template, name):
+    pl.addTool(gef(template), name=name)
+    pl.PhysicsConstructors.append(getattr(pl, name))
+
+
+class G4Physics(LHCbConfigurableUser):
+    # Steering options
+    __slots__ = {
+        "Em": 'NoCuts',
+        "Hadron": 'FTFP_BERT',
+        "GeneralPhys": True,
+        "LHCbPhys": False,
+        "Other": '',
+        "DeltaRays": True,
+        "RichUpgradeConfig": False,
+        "AddPhysConstr": [],
+    }
+
+    _propertyDocDct = {
+        'Em': """Electromagnetic physics used. Choices:
+                 ['Std','Opt1,'Opt2','Opt3','NoCuts','LHCb', 'LHCbNoCuts',
+                 'LHCbOldForE', 'LHCbNoCutsOldForE', 'LHCbTest',
+                 'LHCbTestNoCut' ]""",
+        'GeneralPhys': """Flag to include general physics (e.g. decays).
+                          Choices: [True,False]""",
+        'Hadron':  """Hadronic physics used.
+                      Choices: ['QGSP_BERT','QGSP_BERT_HP','QGSP_FTFP_BERT',
+                                'FTFP_BERT','FTFP_BERT_HP']""",
+        'LHCbPhys': """LHCb specific physics (mostly Cherenkov).
+                       Choices: [True,False]""",
+        'Other': """Anything else. Currently not used ['']""",
+        "DeltaRays": """Simulation of delta rays enabled (default True)""",
+        "RichUpgradeConfig": """Use RICH upgrade (default True)"""
+    }
+
+    def __apply_configuration__(self):
+        pass
+
+    def apply(self):
+        from Configurables import GiGaMT
+        giga = GiGaMT()
+
+        from Configurables import GiGaMTModularPhysListFAC
+        gmpl = giga.addTool(GiGaMTModularPhysListFAC("ModularPL"),
+                            name="ModularPL")
+        giga.PhysicsListFactory = "GiGaMTModularPhysListFAC/ModularPL"
+        gmpl = giga.ModularPL
+        gmpl.PhysicsConstructors = self.getProp('AddPhysConstr')
+
+        # set production cuts
+        ecut = 5.0 * SystemOfUnits.mm
+        if not self.getProp("DeltaRays"):
+            ecut = 10000.0 * SystemOfUnits.m
+        gmpl.CutForElectron = ecut
+        gmpl.CutForPositron = 5.0 * SystemOfUnits.mm
+        gmpl.CutForGamma = 5.0 * SystemOfUnits.mm
+
+        # set up the physics list
+
+        # --- EM physics:
+        self.AddEMPhys(gmpl)
+
+        # --- general  physics (common to all PL):
+        self.AddGenPhysics(gmpl)
+
+        # --- Hadron physics:
+        self.AddHadronPhysics(gmpl)
+
+        # --- LHCb specific physics:
+        self.AddLHCbPhysics(gmpl)
+
+        # --- Other physics
+        self.AddOtherPhysics(gmpl)
+
+        # --- Tracking cuts
+        self.AddTrackingCuts(gmpl)
+
+    def AddEMPhys(self, pl):
+        emPhys = self.getProp('Em')
+        _all = {
+            "Opt1": ("G4EmStandardPhysics_option1", "EmOpt1Physics"),
+            "Opt2": ("G4EmStandardPhysics_option2", "EmOpt2Physics"),
+            "Opt3": ("G4EmStandardPhysics_option3", "EmOpt3Physics"),
+            "Std": ("G4EmStandardPhysics", "EmPhysics"),
+            "NoCuts": ("G4EmStandardPhysics_option1NoApplyCuts",
+                       "EmOpt1NoCutsPhysics")
+        }
+
+        if emPhys in _all:
+            addConstructor(pl, *_all[emPhys])
+            return True
+
+        if 'LHCb' not in emPhys:
+            return False
+
+        if 'Test' in emPhys:
+            addConstructor(pl, "G4EmStandardPhysics_LHCbTest",
+                               "EmOpt1LHCbPhysics")
+        else:
+            addConstructor(pl, "G4EmStandardPhysics_option1LHCb",
+                               "EmOpt1LHCbPhysics")
+        # overwrite cuts depending on choice of list
+        if 'NoCuts' in emPhys:
+            pl.EmOpt1LHCbPhysics.ApplyCuts = False
+        if 'OldForE' in emPhys:
+            pl.EmOpt1LHCbPhysics.NewModelForE = False
+
+        return True
+        raise RuntimeError("Unknown Em PhysicsList chosen ('%s')" % emPhys)
+
+    def AddGenPhysics(self, pl):
+        genPhys = self.getProp('GeneralPhys')
+        # Decays
+        if genPhys:
+            log.info("Applying general physics (Decays,"
+                     "hadron elastic, ion ...)")
+            addConstructor(pl, "G4DecayPhysics", "DecayPhysics")
+            addConstructor(pl, "G4EmExtraPhysics", "EmExtraPhysics")
+            addConstructor(pl, "G4IonPhysics", "IonPhysics")
+        else:
+            log.warning("The general physics (Decays,"
+                        "hadron elastic, ion ...) is disabled")
+
+    def AddHadronPhysics(self, pl):
+        hadronPhys = self.getProp('Hadron')
+        _all = {
+            "QGSP_BERT": [
+                ("G4HadronElasticPhysics", "ElasticPhysics"),
+                ("G4HadronPhysicsQGSP_BERT", "QGSP_BERTPhysics"),
+                ("G4StoppingPhysics", "StoppingPhysics"),
+                ("G4NeutronTrackingCut", "NeutronTrkCut")],
+            "QGSP_BERT_HP": [
+                ("G4HadronElasticPhysicsHP", "ElasticPhysicsHP"),
+                ("G4HadronPhysicsQGSP_BERT_HP", "QGSP_BERT_HPPhysics"),
+                ("G4StoppingPhysics", "StoppingPhysics")],
+            "QGSP_FTFP_BERT": [
+                ("G4HadronElasticPhysics", "ElasticPhysics"),
+                ("G4HadronPhysicsQGSP_FTFP_BERT", "QGSP_FTFP_BERTPhysics"),
+                ("G4StoppingPhysics", "StoppingPhysics"),
+                ("G4NeutronTrackingCut", "NeutronTrkCut")],
+            "FTFP_BERT": [
+                ("G4HadronElasticPhysics", "ElasticPhysics"),
+                ("G4HadronPhysicsFTFP_BERT", "FTFP_BERTPhysics"),
+                ("G4StoppingPhysics", "StoppingPhysics"),
+                ("G4NeutronTrackingCut", "NeutronTrkCut")],
+            "FTFP_BERT_HP": [
+                ("G4HadronElasticPhysicsHP", "ElasticPhysicsHP"),
+                ("G4HadronPhysicsFTFP_BERT_HP", "FTFP_BERT_HPPhysics"),
+                ("G4StoppingPhysics", "StoppingPhysics")],
+        }
+        if hadronPhys in _all:
+            log.info("Applying hadronic physics {}.".format(hadronPhys))
+            for hp in _all[hadronPhys]:
+                addConstructor(pl, *hp)
+            return True
+        else:
+            raise RuntimeError("Unknown Hadron PhysicsList "
+                               "chosen ('%s')" % hadronPhys)
+
+    def AddLHCbPhysics(self, pl):
+        lhcbPhys = self.getProp('LHCbPhys')
+        richUpgradeConfig = self.getProp('RichUpgradeConfig')
+        if lhcbPhys:
+            log.info("Applying LHCb specific physics.")
+            if richUpgradeConfig:
+                self.defineRichMaPmtPhys(pl)
+            else:
+                self.defineRichPhys(pl)
+            pl.PhysicsConstructors.append("GiGaMTPhysUnknownParticles")
+        else:
+            log.warning("The lhcb-related physics (RICH processed,"
+                        "UnknownParticles) is disabled")
+
+    def AddOtherPhysics(self, pl):
+        otherPhys = self.getProp('Other')
+
+        if otherPhys == 'Higgs':
+            log.info("Enabling physics processe for Higgs particles")
+            pl.PhysicsConstructors.append("GiGaMTHiggsParticles")
+        else:
+            if otherPhys != '':
+                raise RuntimeError("Unknown setting for OtherPhys"
+                                   "PhysicsList chosen ('%s')" % otherPhys)
+
+    def AddTrackingCuts(self, pl):
+        log.info("Adding tracking cuts.")
+        from Configurables import TrCutsRunAction
+        pl.addTool(TrCutsRunAction("TrCuts"), name="TrCuts")
+        pl.PhysicsConstructors.append("TrCutsRunAction/TrCuts")
diff --git a/Sim/Gauss/python/Gauss/Utilities.py b/Sim/Gauss/python/Gauss/Utilities.py
new file mode 100644
index 0000000000000000000000000000000000000000..66dff20b27b05f2ab5c72ab552e064d550c1f8f1
--- /dev/null
+++ b/Sim/Gauss/python/Gauss/Utilities.py
@@ -0,0 +1,70 @@
+from Gaudi.Configuration import importOptions
+from Gaussino.Utilities import run_once
+
+
+@run_once
+def _importBaseOptions():
+    importOptions("$STDOPTS/PreloadUnits.opts")
+
+
+def GaussImportOptions(options):
+    _importBaseOptions()
+    importOptions(options)
+
+
+class HelperBase:
+
+    def slotName(self, slot):
+        name = slot
+        if slot == '':
+            name = "Main"
+        return name
+
+    def isGaussMP(self):
+        import argparse
+        parser = argparse.ArgumentParser(description='Hello')
+
+        parser.add_argument("--ncpus", action="store", type=int, default=0)
+        args = parser.parse_known_args()
+        return args[0].ncpus != 0
+
+    ##
+    # Helper functions for spill-over
+    def slot_(self, slot):
+        if slot != '':
+            return slot + '/'
+        return slot
+
+    ##
+    def setTrackersHitsProperties(self, alg, det, slot, dd):
+        alg.MCHitsLocation = '/Event/' + \
+            self.slot_(slot) + 'MC/' + det + '/Hits'
+        if det == 'PuVeto':
+            det = 'VeloPu'
+        alg.CollectionName = det + 'SDet/Hits'
+        alg.Detectors = ['/dd/Structure/LHCb/'+dd]
+
+    ##
+    def evtMax(self):
+        from Configurables import LHCbApp
+        return LHCbApp().evtMax()
+
+    ##
+    def eventType(self):
+        from Configurables import Generation
+        evtType = ''
+        if Generation("Generation").isPropertySet("EventType"):
+            evtType = str(Generation("Generation").EventType)
+        return evtType
+
+    def setLHCbAppDetectors(self):
+        from Configurables import LHCbApp
+        # If detectors set in LHCbApp then use those
+        if hasattr(LHCbApp(), "Detectors"):
+            if not LHCbApp().Detectors:
+                LHCbApp().Detectors = self.getProp("DetectorGeo")["Detectors"]
+            else:
+                log.warning(
+                    "Value of 'LHCbApp().Detectors' already set, using that value: %s" %
+                    (LHCbApp().Detectors))
+        return
diff --git a/Sim/Gauss/python/Gauss/__init__.py b/Sim/Gauss/python/Gauss/__init__.py
index c4235bac5e673c26ca263db08386f26731608db7..a17e4b6aaeb2f14d7c8c53b292e09d2352df195d 100644
--- a/Sim/Gauss/python/Gauss/__init__.py
+++ b/Sim/Gauss/python/Gauss/__init__.py
@@ -1 +1,6 @@
 # entry point for the Python module
+from Physics import G4Physics
+
+__all__ = [
+    G4Physics
+]
diff --git a/Sim/Gauss/xml/Simulation.xml b/Sim/Gauss/xml/Simulation.xml
index 9316bf51fa70ccca5c6e9f5798cce00145ef3b4d..7a9eccb34e35b2869178b7d19e6d5b1c426c6b59 100755
--- a/Sim/Gauss/xml/Simulation.xml
+++ b/Sim/Gauss/xml/Simulation.xml
@@ -37,7 +37,7 @@
     <!-- This part is where simulation attributes are mapped to volumes -->
     <!-- ************************************************************** -->
 
-    &SimAttrRich;
+    <!--&SimAttrRich;-->
 
     <Item name="/dd/Geometry/DownstreamRegion/Muon/lvMuFilter1">
       <Cut particle="0" attr="SimAttrMuFilt"/>
@@ -56,13 +56,6 @@
       <Cut particle="13" attr="SimAttrMuon"/>
       <Cut particle="-13" attr="SimAttrMuon"/>
     </Item>
-
-   <Item name="/dd/Geometry/DownstreamRegion/Muon/lvMuFilter4">
-      <Cut particle="0" attr="SimAttrMuFilt"/>
-      <Cut particle="13" attr="SimAttrMuon"/>
-      <Cut particle="-13" attr="SimAttrMuon"/>
-    </Item>
-    
   </LogVols>
 
   <!-- Define cuts to be applied later in regions -->
diff --git a/Sim/GaussAlgs/.gaudi_project_ignore b/Sim/GaussAlgs/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussCalo/CMakeLists.txt b/Sim/GaussCalo/CMakeLists.txt
index 1ac199ae850d00676f8890252a4c91aadbb18177..3695eba488b8a5144c710b6ccb068136bb4c161a 100644
--- a/Sim/GaussCalo/CMakeLists.txt
+++ b/Sim/GaussCalo/CMakeLists.txt
@@ -7,17 +7,21 @@ gaudi_depends_on_subdirs(Det/CaloDet
                          Det/CaloDetXmlCnv
                          Event/MCEvent
                          Kernel/LHCbKernel
-                         Sim/GaussTools)
+                         Sim/GiGaMTCore
+                         Sim/GiGaMTFactories)
 
 find_package(AIDA)
-
+AddHepMC3()
 find_package(Boost)
 find_package(CLHEP)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS})
 
+add_definitions(-DG4MULTITHREADED)
+add_definitions(-DG4USE_STD11)
+
 gaudi_add_module(GaussCalo
                  src/*.cpp
-                 INCLUDE_DIRS AIDA
-                 LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GaussToolsLib)
+                 INCLUDE_DIRS AIDA GiGaMTFactories
+                 LINK_LIBRARIES CaloDetLib MCEvent LHCbKernel GiGaMTCoreTruthLib GaudiAlgLib)
 
 gaudi_env(SET GAUSSCALOOPTS \${GAUSSCALOROOT}/options)
diff --git a/Sim/GaussCalo/options/GaussGeo-Ecal.opts b/Sim/GaussCalo/options/GaussGeo-Ecal.opts
index d685720b73268496c2b6e22f6d2f468fc552e767..b0cfb040a22edb2669e7598906c0b513ec797565 100644
--- a/Sim/GaussCalo/options/GaussGeo-Ecal.opts
+++ b/Sim/GaussCalo/options/GaussGeo-Ecal.opts
@@ -14,12 +14,12 @@ GaussGeo.Ecal.StartVolumes = {
 };
 
 GaussGeo.Ecal.EndVolume      =  "/dd/Geometry/DownstreamRegion/Ecal/Installation/Ecal" ;
-GaussGeo.Ecal.CollectionName =  "EcalHits"                            ;
+// GaussGeo.Ecal.CollectionName =  "EcalHits"                            ;
 GaussGeo.Ecal.Detector       =  "/dd/Structure/LHCb/DownstreamRegion/Ecal"             ;
 GaussGeo.Ecal.zMin           =  12300. * mm ;
 GaussGeo.Ecal.zMax           =  15000. * mm ;
 
-GaussGeo.Ecal.DetectorPath   =  "/LHCb/Calo"             ;
+// GaussGeo.Ecal.DetectorPath   =  "/LHCb/Calo"             ;
 
 // Input Root histograms
 GaussGeo.Ecal.Histograms = { 
@@ -29,7 +29,7 @@ GaussGeo.Ecal.Histograms = {
 
 // Conversion of Hits
 GetEcalHits.MCHitsLocation = "/Event/MC/Ecal/Hits" ;
-GetEcalHits.CollectionName = "EcalHits" ;
+// GetEcalHits.CollectionName = "EcalHits" ;
 
 // ============================================================================
 // The END 
diff --git a/Sim/GaussCalo/options/GaussGeo-Hcal.opts b/Sim/GaussCalo/options/GaussGeo-Hcal.opts
index 01c4949f8e74717ec1fe5c5a5892ad749a691bfc..e9fd1eb0e823725a20931b8ef3f03fea4de6466d 100644
--- a/Sim/GaussCalo/options/GaussGeo-Hcal.opts
+++ b/Sim/GaussCalo/options/GaussGeo-Hcal.opts
@@ -14,12 +14,12 @@ GaussGeo.Hcal.StartVolumes = {
 };
 
 GaussGeo.Hcal.EndVolume      =  "/dd/Geometry/DownstreamRegion/Hcal/Installation/lvHcal" ;
-GaussGeo.Hcal.CollectionName =  "HcalHits"                            ;
+// GaussGeo.Hcal.CollectionName =  "HcalHits"                            ;
 GaussGeo.Hcal.Detector       =  "/dd/Structure/LHCb/DownstreamRegion/Hcal"             ;
 GaussGeo.Hcal.zMin           =  12300. * mm ;
 GaussGeo.Hcal.zMax           =  15000. * mm ;
 
-GaussGeo.Hcal.DetectorPath   =  "/LHCb/Calo"             ;
+// GaussGeo.Hcal.DetectorPath   =  "/LHCb/Calo"             ;
 
 // Input Root histograms
 GaussGeo.Hcal.Histograms = { 
@@ -34,7 +34,7 @@ GaussGeo.Hcal.Histograms = {
 
 // Conversion of Hits
 GetHcalHits.MCHitsLocation = "/Event/MC/Hcal/Hits" ;
-GetHcalHits.CollectionName = "HcalHits" ;
+// GetHcalHits.CollectionName = "HcalHits" ;
 
 // ============================================================================
 // The END 
diff --git a/Sim/GaussCalo/options/GaussGeo-Prs.opts b/Sim/GaussCalo/options/GaussGeo-Prs.opts
index 2b9e641893694b25dc49b5a784ff8acf6f2eef3c..1205700642fcb215b7b6ab761f0455c5033d91cb 100644
--- a/Sim/GaussCalo/options/GaussGeo-Prs.opts
+++ b/Sim/GaussCalo/options/GaussGeo-Prs.opts
@@ -14,12 +14,12 @@ GaussGeo.Prs.StartVolumes = {
 };
 
 GaussGeo.Prs.EndVolume      =  "/dd/Geometry/DownstreamRegion/Prs/Installation/Prs" ;
-GaussGeo.Prs.CollectionName =  "PrsHits"                            ;
+// GaussGeo.Prs.CollectionName =  "PrsHits"                            ;
 GaussGeo.Prs.Detector       =  "/dd/Structure/LHCb/DownstreamRegion/Prs"             ;
 GaussGeo.Prs.zMin           =  12300. * mm ;
 GaussGeo.Prs.zMax           =  15000. * mm ;
 
-GaussGeo.Prs.DetectorPath   =  "/LHCb/Calo"             ;
+// GaussGeo.Prs.DetectorPath   =  "/LHCb/Calo"             ;
 
 GaussGeo.Prs.IntegrationDelays = { 18.5 * ns , 17.5 * ns , 16.5 * ns } ;
 
@@ -32,7 +32,7 @@ GaussGeo.Prs.Histograms = {
 
 // Conversion of Hits
 GetPrsHits.MCHitsLocation = "/Event/MC/Prs/Hits" ;
-GetPrsHits.CollectionName = "PrsHits" ;
+GetPrsHits.CollectionName = "Prs/Hits" ;
 
 // ============================================================================
 // The END 
diff --git a/Sim/GaussCalo/options/GaussGeo-Spd.opts b/Sim/GaussCalo/options/GaussGeo-Spd.opts
index b0cea2703da69bfd8985ace3d86a1fffcd2583ca..98ee173070e3f424afba2dfb5321b77706ebd355 100644
--- a/Sim/GaussCalo/options/GaussGeo-Spd.opts
+++ b/Sim/GaussCalo/options/GaussGeo-Spd.opts
@@ -14,12 +14,12 @@ GaussGeo.Spd.StartVolumes = {
 };
 
 GaussGeo.Spd.EndVolume      =  "/dd/Geometry/DownstreamRegion/Spd/Installation/Spd" ;
-GaussGeo.Spd.CollectionName =  "SpdHits"                            ;
+// GaussGeo.Spd.CollectionName =  "SpdHits"                            ;
 GaussGeo.Spd.Detector       =  "/dd/Structure/LHCb/DownstreamRegion/Spd"             ;
 GaussGeo.Spd.zMin           =  12300. * mm ;
 GaussGeo.Spd.zMax           =  15000. * mm ;
 
-GaussGeo.Spd.DetectorPath   =  "/LHCb/Calo"             ;
+// GaussGeo.Spd.DetectorPath   =  "/LHCb/Calo"             ;
 
 GaussGeo.Spd.IntegrationDelays = { 18.5 * ns , 17.5 * ns , 16.5 * ns } ;
 
@@ -32,7 +32,7 @@ GaussGeo.Spd.Histograms = {
 
 // Conversion of Hits
 GetSpdHits.MCHitsLocation = "/Event/MC/Spd/Hits" ;
-GetSpdHits.CollectionName = "SpdHits" ;
+GetSpdHits.CollectionName = "Spd/Hits" ;
 
 // ============================================================================
 // The END 
diff --git a/Sim/GaussCalo/src/CaloHit.cpp b/Sim/GaussCalo/src/CaloHit.cpp
old mode 100755
new mode 100644
index 2837a35b9d632070d046d228f127b8cecb2a00dd..0ea235047d498c2f1456471762f8c3834d85604c
--- a/Sim/GaussCalo/src/CaloHit.cpp
+++ b/Sim/GaussCalo/src/CaloHit.cpp
@@ -1,139 +1,3 @@
-// $Id: CaloHit.cpp,v 1.4 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.3  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.2  2002/12/13 16:52:56  ibelyaev
-//  put updated versions of the packages
-//
-// Revision 1.1  2002/12/07 14:41:44  ibelyaev
-//  add new Calo stuff
-// 
-// ============================================================================
-// Include files
-// GiGa
-#include "GiGa/GiGaUtil.h"
-// G4 
-#include "Geant4/G4Allocator.hh"
-// local
 #include "CaloHit.h"
 
-// ============================================================================
-/** @file 
- *  Implementation file for class  CaloHit
- *
- *  @author Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date   2002-12-03
- */
-// ============================================================================
-
-namespace CaloHitLocal
-{
-  // ==========================================================================
-  /** @var  s_Allocator
-   *  allocator to make more efficient creation delete of CaloHits objects  
-   */
-  // ==========================================================================
-  G4Allocator<CaloHit>            s_Allocator ;
-  // ==========================================================================
-  
-  // ==========================================================================
-  /** @var s_Counter 
-   *  statsic instace counter for all functions 
-   */
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  static GiGaUtil::InstanceCounter<CaloHit> s_Counter   ;
-#endif 
-  // ==========================================================================
-}
-
-
-// ============================================================================
-/** standard  constructor 
- *  @param cell ID of calorimeter cell 
- */
-// ============================================================================
-CaloHit::CaloHit( const LHCb::CaloCellID& cell ) 
-  : m_cellID ( cell ) 
-  , m_map    (      ) 
-{
-#ifdef GIGA_DEBUG
-  CaloHitLocal::s_Counter.increment () ;
-#endif  
-}
-
-
-// ============================================================================
-/** copy constructor 
- *  @param right object to be copied 
- */
-// ============================================================================
-CaloHit::CaloHit( const CaloHit& right )
-  : G4VHit   ( right          ) 
-  , m_cellID ( right.cellID() )
-  , m_map    (                )
-{
-  for( CaloHit::iterator hit = right.begin() ; right.end() != hit ; ++hit ) 
-    { m_map[ hit->first ] = hit->second->clone() ; }
-#ifdef GIGA_DEBUG
-  CaloHitLocal::s_Counter.increment () ;
-#endif  
-}
-
-
-// ============================================================================
-/// clone menthod  
-// ============================================================================
-CaloHit* CaloHit::clone() const 
-{ 
-  return new CaloHit( *this ); 
-}
-
-
-// ============================================================================
-/// destructor
-// ============================================================================
-CaloHit::~CaloHit() 
-{
-  /// delete all sub hits 
-  for( TheMap::iterator ihit = m_map.begin() ; m_map.end() != ihit ; ++ihit ) 
-    {
-      CaloSubHit* hit = ihit->second ;
-      if( 0 != hit ) { delete hit ; ihit->second = 0 ; }
-    }
-  // clear the map 
-  m_map.clear();
-  ///
-#ifdef GIGA_DEBUG
-  CaloHitLocal::s_Counter.decrement () ;
-#endif
-}
-
-
-// ============================================================================
-/// overloaded 'new' oerator 
-// ============================================================================
-void* CaloHit::operator new(size_t)
-{
-  void *hit  ;
-  hit = (void *) CaloHitLocal::s_Allocator.MallocSingle () ;
-  return hit ;
-}
-
-
-// ============================================================================
-/// overloaded 'delete' oerator 
-// ============================================================================
-void CaloHit::operator delete( void *hit )
-{ 
-  CaloHitLocal::s_Allocator.FreeSingle( (CaloHit*) hit ); 
-}
-
-
-// ============================================================================
-// The End 
-// ============================================================================
+G4ThreadLocal G4Allocator<CaloHit>* aCaloHitAllocator{nullptr};
diff --git a/Sim/GaussCalo/src/CaloHit.h b/Sim/GaussCalo/src/CaloHit.h
index ca51785f7f382629cc36b4b04a9c91a7bc51d665..f9354287c9050dc6478cae67244ad8cab1b27abf 100755
--- a/Sim/GaussCalo/src/CaloHit.h
+++ b/Sim/GaussCalo/src/CaloHit.h
@@ -1,235 +1,198 @@
-// $Id: CaloHit.h,v 1.7 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.6  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.5  2003/07/22 19:05:29  ibelyaev
-//  improve doxygen documentation
-//
-// Revision 1.4  2003/07/10 11:27:56  ibelyaev
-//  fixes to please the gcc3.2 compiler
-//
-// Revision 1.3  2003/07/08 19:40:57  ibelyaev
-//  Sensitive Plane Detector + improved printout
-//
-// Revision 1.2  2002/12/13 16:52:57  ibelyaev
-//  put updated versions of the packages
-//
-// Revision 1.2  2002/12/07 21:19:14  ibelyaev
-//  few optimization updates
-//
-// Revision 1.1  2002/12/07 14:41:44  ibelyaev
-//  add new Calo stuff
-// 
-// ============================================================================
-#ifndef CALOSIM_CALOHIT_H 
-#define CALOSIM_CALOHIT_H 1
+#pragma once
 // Include files
 // GaudiKernel
-#include "GaudiKernel/StatusCode.h" 
+#include "GaudiKernel/StatusCode.h"
 // Kernel
 #include "Kernel/CaloCellID.h"
-// GiGa 
+// GiGa
 #include <unordered_map>
-#include "GiGa/GiGaUtil.h"
-// G4 
-#include "Geant4/G4VHit.hh"
+// G4
+#include "Geant4/G4Allocator.hh"
 #include "Geant4/G4THitsCollection.hh"
-// local 
+#include "Geant4/G4VHit.hh"
+// local
 #include "CaloSim.h"
-#include "CaloSubHit.h"
 #include "CaloSimHash.h"
+#include "CaloSubHit.h"
 // forward decalration
-template <class T> class G4THitsCollection;
+template <class T>
+class G4THitsCollection;
 
 /** @class CaloHit CaloHit.h
- * 
+ *
  *  Elementary "hit" for calorimeter devices.
- *  The class represents an list of energy depositions 
- *  from all MC particles for given calorimeter cell 
+ *  The class represents an list of energy depositions
+ *  from all MC particles for given calorimeter cell
  *
  *  The new created hit (of type <tt>CaloHit</tt>
- *  will be attributed to the parent particle of the track 
+ *  will be attributed to the parent particle of the track
  *  with 2 exceptions
- *   - if the track is already forced to be stored 
- *   - if the track is produces outside the "forbidden" zone 
- * 
- *  
+ *   - if the track is already forced to be stored
+ *   - if the track is produces outside the "forbidden" zone
+ *
+ *
  *  @author Vanya Belyaev Ivan.Belyaev@itep.ru
  *  @date   2002-12-03
  */
 
-class CaloHit : public G4VHit
-{
-public:
-  
-  /// the actual data type for particle 
-  typedef int                               TrackID  ;
-  /// collection of sub-hits 
-  typedef std::unordered_map<TrackID,CaloSubHit*>  TheMap   ;
-  /// actual type of the iterator 
-  typedef TheMap::const_iterator            iterator ;
-  
-public:
-  
-  /** standard  constructor 
-   *  @param cell ID of calorimeter cell 
+class CaloHit : public G4VHit {
+  public:
+  /// the actual data type for particle
+  typedef int TrackID;
+  /// collection of sub-hits
+  // FIXME: Use thread-local allocator
+  typedef std::unordered_map<TrackID, CaloSubHit*> TheMap;
+  /// actual type of the iterator
+  typedef TheMap::const_iterator iterator;
+
+  public:
+  /** standard  constructor
+   *  @param cell ID of calorimeter cell
    */
-  CaloHit( const LHCb::CaloCellID& cell = LHCb::CaloCellID() ) ;
+  inline CaloHit(const LHCb::CaloCellID& cell = LHCb::CaloCellID())
+      : m_cellID{cell}, m_map{} {}
 
-  /** copy constructor 
-   *  @param right object to be copied 
+  /** copy constructor
+   *  @param right object to be copied
    */
-  CaloHit( const CaloHit& right );
-  
-  /// clone method (virtual constructor)  
-  virtual CaloHit* clone() const ;
-  
-  /// destructor / delete all subhits 
-  virtual ~CaloHit() ;
-  
-  void* operator  new    ( size_t    ) ;
-  void  operator  delete ( void *hit ) ;
-  
-  /// get the cellID 
-  const LHCb::CaloCellID& cellID () const          { return m_cellID        ; }
-  // set new cellID 
-  void  setCellID ( const LHCb::CaloCellID& cell ) {        m_cellID = cell ; }
-  
-  /** get the hit for the given particle 
-   * 
-   *  @code 
-   * 
+  inline CaloHit(const CaloHit& right)
+      : G4VHit(right), m_cellID(right.cellID()), m_map() {
+    for (auto& [id, hit] : *this)
+
+    {
+      m_map[id] = new CaloSubHit{*hit};
+    }
+  }
+
+  /// destructor / delete all subhits
+  inline virtual ~CaloHit() {
+    /// delete all sub hits
+    for (TheMap::iterator ihit = m_map.begin(); m_map.end() != ihit; ++ihit) {
+      CaloSubHit* hit = ihit->second;
+      if (0 != hit) {
+        delete hit;
+        ihit->second = 0;
+      }
+    }
+    m_map.clear();
+  }
+
+  inline void* operator new(size_t);
+  inline void operator delete(void* hit);
+
+  /// get the cellID
+  inline const LHCb::CaloCellID& cellID() const { return m_cellID; }
+  // set new cellID
+  inline void setCellID(const LHCb::CaloCellID& cell) { m_cellID = cell; }
+
+  /** get the hit for the given particle
+   *
+   *  @code
+   *
    *  CaloHit*                hit   = ... ;
    *  const CaloHit::TrackID  track = ... ;
-   *  
+   *
    *  CaloSubHit*& subhit = hit->hit( track ) ;
-   *  if ( 0 == subhit ) 
-   *        { subhit = new CaloSubHit( hit->cellID() , track ) ; } 
-   *  
+   *  if ( 0 == subhit )
+   *        { subhit = new CaloSubHit( hit->cellID() , track ) ; }
+   *
    *  @endcode
    *
-   *  @return the sub-hit for the given track id (or NULL) 
+   *  @return the sub-hit for the given track id (or NULL)
    */
-  CaloSubHit*& hit( const TrackID track )    { return m_map[ track ] ; }
-  
+  inline CaloSubHit*& hit(const TrackID track) { return m_map[track]; }
+
   /** access to 'begin' iterator of the sub-hit collections (const)
-   *  
+   *
    *  @code
    *
    *  CaloHit* hit = ... ;
-   *  
-   *  for ( CaloHit::iterator entry = hit->begin() ; 
-   *        hit->end() != entry ; ++entry  ) 
+   *
+   *  for ( CaloHit::iterator entry = hit->begin() ;
+   *        hit->end() != entry ; ++entry  )
    *       {
-   *         const CaloHit::TrackID track  = entry->first  ; 
-   *         const CaloSubHit*      subhit = entry->second ; 
+   *         const CaloHit::TrackID track  = entry->first  ;
+   *         const CaloSubHit*      subhit = entry->second ;
    *       }
    *
    *  @endcode
-   *  
+   *
    *  @return 'begin' iterator for sequence of subhits
    */
-  iterator begin     () const { return m_map.begin () ; }
+  iterator begin() const { return m_map.begin(); }
   /** access to 'end'   iterator of the sub-hit collections (const)
-   *  
+   *
    *  @code
    *
    *  CaloHit* hit = ... ;
-   *  
-   *  for ( CaloHit::iterator entry = hit->begin() ; 
-   *        hit->end() != entry ; ++entry  ) 
+   *
+   *  for ( CaloHit::iterator entry = hit->begin() ;
+   *        hit->end() != entry ; ++entry  )
    *       {
-   *         const CaloHit::TrackID track  = entry->first  ; 
-   *         const CaloSubHit*      subhit = entry->second ; 
+   *         const CaloHit::TrackID track  = entry->first  ;
+   *         const CaloSubHit*      subhit = entry->second ;
    *       }
    *
    *  @endcode
-   *  
+   *
    *  @return 'end' iterator for sequence of subhits
    */
-  iterator end       () const { return m_map.end   () ; }
-  
-  /// number of entries/map size 
-  size_t   size      () const { return m_map.size  () ; }
-  size_t   entries   () const { return       size  () ; }
-  
-  /// total number of (sub)entries 
-  size_t   totalSize () const 
-  {
-    size_t size = 0 ;
-    for( iterator hit = begin() ; end() != hit ; ++hit ) 
-      { if( 0 != hit->second ) { size += hit->second->size() ; } }
-    return size ;
+  iterator end() const { return m_map.end(); }
+
+  /// number of entries/map size
+  inline size_t size() const { return m_map.size(); }
+  inline size_t entries() const { return size(); }
+
+  /// total number of (sub)entries
+  inline size_t totalSize() const {
+    size_t size = 0;
+    for (iterator hit = begin(); end() != hit; ++hit) {
+      if (0 != hit->second) {
+        size += hit->second->size();
+      }
+    }
+    return size;
   };
   /** the total energy (integrated over all time slots  and all particles)
-   *  
+   *
    *  @code
-   * 
+   *
    *  const CaloHit*           hit = ... ;
    *  const CaloSubHit::Energy e   = hit->energy() ;
    *
-   *  @endcode 
-   *  
-   *  @return the total energy (integrated over all time 
+   *  @endcode
+   *
+   *  @return the total energy (integrated over all time
    *                             slots  and all particles)
    */
-  CaloSubHit::Energy energy () const 
-  {
-    CaloSubHit::Energy e = 0 ;
-    for( iterator entry = begin() ; end() != entry ; ++entry ) 
-      {
-        const CaloSubHit* hit = entry -> second  ;
-        if( 0 != hit ) { e += hit->energy() ; } 
+  inline CaloSubHit::Energy energy() const {
+    CaloSubHit::Energy e = 0;
+    for (iterator entry = begin(); end() != entry; ++entry) {
+      const CaloSubHit* hit = entry->second;
+      if (0 != hit) {
+        e += hit->energy();
       }
-    return e ;
+    }
+    return e;
   }
-  
-private:
-  
-  LHCb::CaloCellID  m_cellID ;
-  TheMap      m_map    ;
+
+  private:
+  LHCb::CaloCellID m_cellID;
+  TheMap m_map;
 };
 
-/// type for the hit collection 
-typedef G4THitsCollection<CaloHit> CaloHitsCollection ;
+/// type for the hit collection
+typedef G4THitsCollection<CaloHit> CaloHitsCollection;
 
-// ============================================================================
-/** @fn  caloHits
- *  Fast cast of G4VHitsCollection interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHitsCollection interface 
- *  @return cast (dynamic or static) to CaloHitsColelction*
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline CaloHitsCollection* caloHits( G4VHitsCollection* g4 )
-{
-  GiGaUtil::FastCast<G4VHitsCollection,CaloHitsCollection> cast ;
-  return cast( g4 );  
-}
+extern G4ThreadLocal G4Allocator<CaloHit>* aCaloHitAllocator;
 
-// ============================================================================
-/** @fn  caloHit
- *  Fast cast of G4VHit interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHit interface 
- *  @return cast (dynamic or static) to CaloHit
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline CaloHit* caloHit( G4VHit* g4 )
-{
-  GiGaUtil::FastCast<G4VHit,CaloHit> cast ;
-  return cast( g4 );  
+inline void* CaloHit::operator new(size_t) {
+  if (!aCaloHitAllocator) {
+    aCaloHitAllocator = new G4Allocator<CaloHit>;
+  }
+  return (void*)aCaloHitAllocator->MallocSingle();
 }
 
-
-// ============================================================================
-// The END 
-// ============================================================================
-#endif // CALOSIM_CALOHIT_H
-// ============================================================================
+inline void CaloHit::operator delete(void* aHit) {
+  aCaloHitAllocator->FreeSingle((CaloHit*)aHit);
+}
diff --git a/Sim/GaussCalo/src/CaloSensDet.cpp b/Sim/GaussCalo/src/CaloSensDet.cpp
deleted file mode 100755
index 6af945101e1099bcae46f76b388afdf763b9feeb..0000000000000000000000000000000000000000
--- a/Sim/GaussCalo/src/CaloSensDet.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-// $Id: CaloSensDet.cpp,v 1.24 2008-07-11 10:47:44 robbep Exp $
-// Include files
-
-// SRD & STD
-#include <algorithm>
-#include <vector>
-#include <sstream>
-
-// LHCbDefintions
-#include "CLHEP/Geometry/Point3D.h"
-
-// from Gaudi
-#include "GaudiKernel/Point3DTypes.h"
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/SmartDataPtr.h"
-#include "GaudiKernel/IDataProviderSvc.h"
-#include "GaudiKernel/IHistogramSvc.h"
-#include "GaudiKernel/Stat.h"
-
-// GaussTools
-#include "GaussTools/GaussTrackInformation.h"
-
-// Geant4
-#include "Geant4/G4Step.hh"
-#include "Geant4/G4TouchableHistory.hh"
-#include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
-#include "Geant4/G4EnergyLossTables.hh"
-#include "Geant4/G4Material.hh"
-#include "Geant4/G4MaterialCutsCouple.hh"
-
-// GiGaCnv
-#include "GiGaCnv/GiGaVolumeUtils.h"
-
-// CaloDet
-#include "CaloDet/DeCalorimeter.h"
-
-// local
-#include "CaloSensDet.h"
-#include "CaloHit.h"
-#include "CaloSimHash.h"
-
-// AIDA
-#include "AIDA/IHistogram1D.h"
-
-// Boost
-#include "boost/format.hpp"
-
-// ============================================================================
-/** @file
- *
- *  Implementation of class CaloSensDet
- *
- *  @author Vanya Belyaev
- *  @date   23/01/2001
- */
-// ============================================================================
-
-// ============================================================================
-/** standard constructor
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see AlgTool
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-CaloSensDet::CaloSensDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector ( name  )
-  , GiGaSensDetBase      ( type , name , parent )
-  , m_endVolumeName      ( "World" )
-  , m_end                ( 0       )
-  , m_startVolumeNames   (         )
-  , m_start              (         )
-  , m_volumesLocated     ( false   )
-  ///
-  , m_collectionName     ( "Hits"  )
-  , m_table              ()
-  , m_hitmap             ()
-  //
-  , m_caloName           ( DeCalorimeterLocation::Ecal )
-  , m_calo               ( 0 )
-  , m_caloID             ( 0 )
-  ///
-  , m_zmin               ( -1 * CLHEP::km )  // minimal z of forbidden zone
-  , m_zmax               (  1 * CLHEP::km )  // maximal z of forbidden zone
-  ///
-  , m_collection         ( 0 )
-  // input histograms
-  , m_histoNames         (   )
-  , m_histos             (   )
-  , m_histoSvc           ( 0 )
-  //
-  , m_birk_c1            ( 0.013  * CLHEP::g/CLHEP::MeV/CLHEP::cm2 ) // 1st coef. of Birk's
-  , m_birk_c2            ( 9.6E-6 * CLHEP::g*CLHEP::g/CLHEP::MeV/CLHEP::MeV/CLHEP::cm2/CLHEP::cm2 ) // 2nd coef
-  //. of Birk's law correction of c1 for 2e charged part.
-  , m_birk_c1correction  ( 0.57142857                   )
-  /// correction to t0
-  , m_dT0                ( 0.5 * CLHEP::ns              )
-{
-  setProperty     ( "DetectorDataProvider" ,  "DetectorDataSvc"   ) ;
-
-  declareProperty ( "StartVolumes"         ,  m_startVolumeNames  ) ;
-  declareProperty ( "EndVolume"            ,  m_endVolumeName     ) ;
-  declareProperty ( "CollectionName"       ,  m_collectionName    ) ;
-  declareProperty ( "Detector"             ,  m_caloName          ) ;
-  declareProperty ( "zMin"                 ,  m_zmin              ) ;
-  declareProperty ( "zMax"                 ,  m_zmax              ) ;
-  //
-  declareProperty ( "BirkC1"               ,  m_birk_c1           ) ;
-  declareProperty ( "BirkC1cor"            ,  m_birk_c1correction ) ;
-  declareProperty ( "BirkC2"               ,  m_birk_c2           ) ;
-  //
-  declareProperty ( "dT0"                  ,  m_dT0               ) ;
-  // input histograms(parametrization)
-  declareProperty ( "Histograms"           ,  m_histoNames        ) ;
-}
-
-// ============================================================================
-/** standard initialization (Gaudi)
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see   AlgTool
- *  @see  IAlgTool
- *  @return statsu code
- */
-// ============================================================================
-StatusCode CaloSensDet::initialize   ()
-{
-  // initialze the base class
-  StatusCode sc = GiGaSensDetBase::initialize();
-  if( sc.isFailure() )
-    { return Error("Could not initialize the base class!",sc);}
-  //
-  // clear collection name vector
-  collectionName.clear  () ;
-  collectionName.insert ( m_collectionName );
-  ///
-  m_calo = getDet<DeCalorimeter>(  m_caloName );
-  if( 0 == m_calo   ) { return StatusCode::FAILURE                     ; }
-  m_caloID   = CaloCellCode::CaloNumFromName( caloName()             ) ;
-  if( 0 >  caloID() ) { return Error("Invalid detector name/number!" ) ; }
-  ///
-  m_histoSvc = svc<IHistogramSvc> ( "HistogramDataSvc" , true ) ;
-  { // load all input histos
-    for( Names::const_iterator ihist = m_histoNames.begin() ;
-         m_histoNames.end() != ihist ; ++ihist )
-      {
-        SmartDataPtr<IHistogram1D> pHist( histoSvc() , *ihist );
-        IHistogram1D* hist = pHist ;
-        if( 0 == hist )
-          { return Error("Cannot load histogram '"+(*ihist)+"'"); }
-        m_histos.push_back ( hist ) ;
-      }
-    if ( histos().empty() )
-    { Warning ( "Empty vector of input time-histograms" ) ; }
-  }
-  ///
-  return StatusCode::SUCCESS ;
-}
-
-// ============================================================================
-/** standard finalization (Gaudi)
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see   AlgTool
- *  @see  IAlgTool
- *  @return statsu code
- */
-// ============================================================================
-StatusCode CaloSensDet::finalize    ()
-{
-  // reset the detector element
-  m_calo         = 0 ;
-  // clear the translation table
-  m_table  .clear () ;
-  // clear hit map
-  m_hitmap .clear () ;
-  // clear volumes
-  m_start  .clear () ;
-  // clear histograms
-  m_histos .clear () ;
-  // finalize the base class
-  return GiGaSensDetBase::finalize();
-}
-
-// ============================================================================
-/** helpful method to locate start and end volumes
- *  @return status code
- */
-// ============================================================================
-StatusCode  CaloSensDet::locateVolumes()
-{
-  // locate start volumes
-  for( Names::const_iterator vol =  m_startVolumeNames.begin() ;
-       m_startVolumeNames.end() != vol ; ++vol )
-    {
-      // look through converted volumes
-      const G4LogicalVolume* lv = GiGaVolumeUtils::findLVolume   ( *vol );
-      if( 0 == lv )
-        { return Error("G4LogicalVolume* points to 0 for "+ (*vol) );}
-      m_start.push_back( lv );
-    }
-  if( m_start.empty() ) { return Error("Size of 'StartVolumes' is 0 "); }
-  // locate end volume : look through converted volumes
-  m_end = GiGaVolumeUtils::findLVolume   ( m_endVolumeName );
-  if( 0 == m_end )
-    { return Error("G4LogicalVolume* points to 0 for '"+m_endVolumeName+"'");}
-  // set flag
-  m_volumesLocated = true ;
-  //
-  return StatusCode::SUCCESS ;
-}
-
-// ============================================================================
-/** method from G4
- *  (Called at the begin of each event)
- *  @see G4VSensitiveDetector
- *  @param HCE pointer to hit collection of current event
- */
-// ============================================================================
-void CaloSensDet::Initialize( G4HCofThisEvent* HCE )
-{
-  //
-  if( !m_volumesLocated )
-  {
-    StatusCode sc = locateVolumes();
-    if ( sc.isFailure() ) { Error("Error from 'locateVolumes' method",sc); }
-  }
-  Assert ( m_volumesLocated , "Could not locate volumes!");
-  //
-  m_collection = new CaloHitsCollection ( SensitiveDetectorName ,
-                                          collectionName[0]     ) ;
-  //
-  const int id  = GetCollectionID( 0 ) ;
-
-  HCE -> AddHitsCollection( id , m_collection );
-
-  //
-  if ( msgLevel ( MSG::DEBUG ) )
-  {
-    debug() << " Initialize(): CollectionName='"
-            << m_collection->GetName   ()
-            << "' for SensDet='"
-            << m_collection->GetSDname ()
-            <<"'" << endmsg ;
-  }
-  //
-  m_hitmap.clear() ;
-}
-
-// ============================================================================
-/** method from G4
- *  (Called at the end of each event)
- *  @see G4VSensitiveDetector
- *  @param HCE pointer to hit collection of current event
- */
-// ============================================================================
-void CaloSensDet::EndOfEvent ( G4HCofThisEvent* /* HCE */ )
-{
-  /// clear the map
-  m_hitmap.clear();
-
-  if ( !printStat() && !msgLevel ( MSG::DEBUG ) ) { return ; }
-
-  if ( 0 == m_collection )
-  { Warning ( " EndOfEvent(): HitCollection points to NULL " ) ; return ; }
-  typedef std::vector<CaloHit*> Hits ;
-  const Hits* hits = m_collection ->GetVector() ;
-  if ( 0 == hits )
-  { Error   (" EndOfEvent(): HitVector* points to NULL "     ) ; return ; }
-
-  // initialize counters
-  const size_t nhits = hits->size()  ;
-  size_t nshits = 0 ;
-  size_t nslots = 0 ;
-  double energy = 0 ;
-
-  // the loop over all hits
-  for ( Hits::const_iterator ihit = hits->begin() ;
-        hits->end() != ihit ; ++ihit )
-  {
-    const CaloHit* hit = *ihit ;
-    if( 0 == hit ) { continue ; }                           // CONTINUE
-    nshits += hit -> size      () ;
-    nslots += hit -> totalSize () ;
-    energy += hit -> energy    () ;
-  }
-
-  energy /= CLHEP::GeV ;                               // NB: rescale to GeV
-
-  counter ( "#hits"    ) += nhits  ;
-  counter ( "#subhits" ) += nshits ;
-  counter ( "#tslots"  ) += nslots ;
-  counter ( "#energy"  ) += energy ;
-
-  if ( msgLevel ( MSG::DEBUG ) )
-  {
-    always() << boost::format
-      ( " #Hits=%5d #SubHits=%5d #Slots=%5d Energy=%8.3g[GeV] " )
-      % nhits % nshits % nslots % energy << endmsg ;
-  }
-
-}
-
-// ============================================================================
-/** process the hit
- *  @param step     pointer to current Geant4 step
- *  @param history  pointert to touchable history
- */
-// ============================================================================
-bool CaloSensDet::ProcessHits
-( G4Step* step                      ,
-  G4TouchableHistory* /* history */ )
-{
-
-  if( 0 == step ) { return false ; }
-  ///
-  const double                      deposit  = step-> GetTotalEnergyDeposit () ;
-  if( deposit <= 0            ) { return false ; }                 // RETURN
-
-  const G4Track*              const track    = step     -> GetTrack      () ;
-  const int                         trackID  = track    -> GetTrackID    () ;
-  const G4ParticleDefinition* const particle = track    -> GetDefinition () ;
-  const double                      charge   = particle -> GetPDGCharge  () ;
-
-  if ( 0 == int ( charge * 10 ) ) { return false ; }               // RETURN
-
-  const G4StepPoint* const          preStep  = step    -> GetPreStepPoint () ;
-  const HepGeom::Point3D<double>&   prePoint = preStep -> GetPosition     () ;
-  const double                      time     = preStep -> GetGlobalTime   () ;
-  const G4MaterialCutsCouple* const material = preStep ->
-    GetMaterialCutsCouple () ;
-
-  const LHCb::CaloCellID cellID = cell ( preStep ) ;
-  if ( LHCb::CaloCellID() == cellID ) { return false ; }
-
-  // get the existing hit
-  CaloHit*& hit = m_hitmap[ cellID ] ;
-  if ( 0 == hit )
-  {
-    // create new hit
-    hit = new CaloHit      ( cellID ) ;
-    // add it into collection
-    m_collection -> insert ( hit    ) ;
-  }
-
-  // check the status of the track
-  GaussTrackInformation* info =
-    gaussTrackInformation ( track->GetUserInformation() );
-  if( 0 == info )
-  { Error("Invalid Track information") ; return false ; }     // RETURN
-
-  // ID of the track to be stored
-  int sTrackID     = track -> GetParentID () ;
-
-  // already marked to be stored:
-  if     ( info -> toBeStored()     ) { sTrackID = trackID ; }
-  else
-  {
-    // z-position of production vertex
-    const double z0 = track->GetVertexPosition().z() ;
-    // outside the "forbidden zone" ?
-    if ( z0 < zMin() || z0 > zMax ()  ) { sTrackID = trackID ; }
-  }
-
-  // Does the hit exist for the given track?
-  CaloSubHit*& sub  = hit->hit( sTrackID ) ;                   // ATTENTION
-  // create new subhit if needed
-  if ( 0 == sub ) { sub = new CaloSubHit ( cellID , sTrackID ) ; }
-  // update the track information
-  if ( trackID == sTrackID ) { info->addToHits ( sub ) ; }
-
-  // perform the specific sub-detector action
-  StatusCode sc = fillHitInfo ( sub       ,
-                                prePoint  ,
-                                time      ,
-                                deposit   ,
-                                track     ,
-                                particle  ,
-                                material  ,
-                                step      ) ;
-
-  if ( sc.isFailure() ){ Error("The SubHit information is not filled!",sc) ; }
-
-  return true ;
-}
-
-// ============================================================================
diff --git a/Sim/GaussCalo/src/CaloSensDet.h b/Sim/GaussCalo/src/CaloSensDet.h
index 83098c788c1a6669b1b1f599850c10f7a8e602cb..243b073b65107bac4c985e792781564c1b951b71 100755
--- a/Sim/GaussCalo/src/CaloSensDet.h
+++ b/Sim/GaussCalo/src/CaloSensDet.h
@@ -1,73 +1,58 @@
-// $Id: CaloSensDet.h,v 1.15 2007-03-18 21:33:19 gcorti Exp $
-#ifndef       GAUSSCALO_CaloSensDet_H
-#define       GAUSSCALO_CaloSensDet_H 1
+#pragma once
 
 // GaudiKernel
 #include "GaudiKernel/HashMap.h"
 
+// from Gaudi
+#include "GaudiKernel/Counters.h"
+#include "GaudiKernel/Point3DTypes.h"
+
 // GiGa
-#include "GiGa/GiGaSensDetBase.h"
+#include "Geant4/G4VSensitiveDetector.hh"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
 
 // AIDA
 #include "AIDA/IHistogram1D.h"
 
 // local
+#include "CaloHit.h"
 #include "CaloSim.h"
 #include "CaloSimHash.h"
-#include "CaloHit.h"
 
 // GEANT4
+#include "Geant4/G4EnergyLossTables.hh"
 #include "Geant4/G4Material.hh"
 #include "Geant4/G4MaterialCutsCouple.hh"
 
 #include "CLHEP/Geometry/Transform3D.h"
 
-// forward declarations
-class DeCalorimeter ;  // CaloDet
-class IHistogramSvc ;  // GaudiKernel
-
 /** @class CaloSensDet CaloSensDet.h CaloSensDet.h
  *
  *
  *  @author  Vanya Belyaev
  *  @date    23/01/2001
  */
-class CaloSensDet: public GiGaSensDetBase
-{
-public:
+
+template <typename CELLGETTER>
+class CaloSensDet : public G4VSensitiveDetector,
+                    public virtual CELLGETTER,
+                    public virtual GiGaMessage {
+  public:
   /// useful type for list of names
-  typedef std::vector<std::string>              Names      ;
+  typedef std::vector<std::string> Names;
   /// useful type for list of logical volumes
-  typedef std::vector<const G4LogicalVolume*>   Volumes    ;
+  typedef std::vector<const G4LogicalVolume*> Volumes;
   /// translator from Path to CellID
-  typedef GaudiUtils::HashMap<CaloSim::Path,LHCb::CaloCellID> Table  ;
-  typedef GaudiUtils::HashMap<LHCb::CaloCellID,CaloHit*>      HitMap ;
+  typedef GaudiUtils::HashMap<CaloSim::Path, LHCb::CaloCellID> Table;
+  typedef GaudiUtils::HashMap<LHCb::CaloCellID, CaloHit*> HitMap;
   /// type for all histograms
-  typedef std::vector<AIDA::IHistogram1D*>            Histos     ;
+  typedef std::vector<AIDA::IHistogram1D*> Histos;
   /// the typedef for vector of fractions
-  typedef std::vector<double>                   Fractions  ;
-
-public :
+  typedef std::vector<double> Fractions;
 
-  /** standard initialization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode initialize   () override;
-
-  /** standard finalization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode finalize    () override;
-
-public:
+  public:
+  CaloSensDet(const std::string& name);
+  virtual ~CaloSensDet() = default;
 
   /** process the hit.
    *  The method is invoked by G4 for each step in the
@@ -87,123 +72,78 @@ public:
    *  @param history  pointert to touchable history
    *  @attention One should not redefine this method for specific sub-detectors.
    */
-  bool ProcessHits
-  ( G4Step*             step    ,
-    G4TouchableHistory* history ) override;
+  bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
+
+  // ============================================================================
+  /** helper method to locate the Calorimeter cell to which
+   *  G4 point belongs to
+   *  @param point G4 point
+   *  @retuen calorimeter cell identifier
+   */
+  // ============================================================================
+  inline LHCb::CaloCellID cell(const G4StepPoint* point) const;
 
   /** method from G4
    *  (Called at the begin of each event)
    *  @see G4VSensitiveDetector
    *  @param HCE pointer to hit collection of current event
    */
-  void Initialize( G4HCofThisEvent* HCE ) override;
+  void Initialize(G4HCofThisEvent* HCE) override;
 
   /** method from G4
    *  (Called at the end of each event)
    *  @see G4VSensitiveDetector
    *  @param HCE pointer to hit collection of current event
    */
-  void EndOfEvent( G4HCofThisEvent* HCE ) override;
-
-protected:
-
-  /** helpful method to locate start and end volumes
-   *  @return status code
-   */
-  StatusCode locateVolumes();
-
-public:
-
-  /** standard constructor
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
-   */
-  CaloSensDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~CaloSensDet() {};
-
-private:
+  void EndOfEvent(G4HCofThisEvent* HCE) override;
 
+  public:
   // no default constructor
-  CaloSensDet() ;
+  CaloSensDet() = delete;
   // no copy constructor
-  CaloSensDet           ( const CaloSensDet& );
+  CaloSensDet(const CaloSensDet&) = delete;
   // no assignement
-  CaloSensDet& operator=( const CaloSensDet& ) ;
-
-protected:
-
-  /// acess to detector element
-  inline const DeCalorimeter* calo     () const  { return m_calo       ; }
-
-  /// return the (De)Calorimeter name
-  inline const std::string&   caloName () const { return m_caloName    ; }
-
-  /// return the (De)Calorimeter ID
-  inline int                  caloID   () const  { return m_caloID     ; }
+  CaloSensDet& operator=(const CaloSensDet&) = delete;
 
+  protected:
   /// access to hit collection
-  inline CaloHitsCollection*  hits     () const  { return m_collection ; }
+  inline CaloHitsCollection* hits() const { return m_collection; }
 
   /// access to translation table
-  inline Table&               table    ()        { return m_table      ; }
+  inline Table& table() { return m_table; }
 
   /// access to hit map
-  inline HitMap&              hitmap   ()        { return m_hitmap     ; }
+  inline HitMap& hitmap() { return m_hitmap; }
 
   /// access to minimal z
-  inline double               zMin     () const  { return m_zmin       ; }
+  inline double zMin() const { return m_zmin; }
 
   /// access to maximal z
-  inline double               zMax     () const  { return m_zmax       ; }
+  inline double zMax() const { return m_zmax; }
 
   /// the additive correction to 't0' evaluation
-  inline double               dT0      () const  { return m_dT0        ; }
+  inline double dT0() const { return m_dT0; }
 
   /** the evaluation of t0 for given calorimetr cell
    *  @param cellID the calorimeter cell identifier
    *  @return "time"-parameter for the given cell
    *           it is evaluated per cell basis in DeCalorimeter
    */
-  inline double               t0       ( const LHCb::CaloCellID& cellID ) const ;
+  inline double t0(const LHCb::CaloCellID& cellID) const;
 
   /// the first coefficient of Birks's law
-  inline double               birk_c1    () const { return m_birk_c1 ; }
+  inline double birk_c1() const { return m_birk_c1; }
   /// the second coefficient of Birks's law
-  inline double               birk_c2    () const { return m_birk_c2 ; }
+  inline double birk_c2() const { return m_birk_c2; }
   /// the correction to the first coefficient of Birks's law
-  inline double               birk_c1cor () const
-  { return m_birk_c1correction ; }
+  inline double birk_c1cor() const { return m_birk_c1correction; }
 
   /// the accessor to all time-histograms      (const version)
-  inline const Histos&        histos     () const { return m_histos     ; }
+  inline const Histos& histos() const { return m_histos; }
   /// the accessor to all time-histograms  (non-const version)
-  inline       Histos&        histos     ()       { return m_histos     ; }
-  /// the accessor to the names of  histograms
-  inline const Names&         histoNames () const { return m_histoNames ; }
-
-  /// accessor to histogram service
-  inline IHistogramSvc*       histoSvc   () const { return m_histoSvc   ; }
-
-protected:
-
-  /** helper method to locate the Calorimeter cell to which
-   *  G4 point belongs to
-   *  @param point G4 point
-   *  @retuen calorimeter cell identifier
-   */
-  inline LHCb::CaloCellID cell ( const G4StepPoint* point ) const ;
-
-protected:
+  inline Histos& histos() { return m_histos; }
 
+  protected:
   /** fill the hit with the concrete information about the energy and the time.
    *  The function is to be called from ProcessHits method.
    *
@@ -225,15 +165,13 @@ protected:
    *    (Birk's,timing, non-uniformities, etc ) need to be applied here!
    *
    */
-  virtual StatusCode    fillHitInfo
-  ( CaloSubHit*                 hit         ,
-    const HepGeom::Point3D<double>& prePoint    ,
-    const double                globalTime  ,
-    const double                deposit     ,
-    const G4Track*              track       ,
-    const G4ParticleDefinition* pdef        ,
-    const G4MaterialCutsCouple* material    ,
-    const G4Step*               step        ) const = 0 ;
+  virtual bool fillHitInfo(CaloSubHit* hit,
+                           const HepGeom::Point3D<double>& prePoint,
+                           const double globalTime, const double deposit,
+                           const G4Track* track,
+                           const G4ParticleDefinition* pdef,
+                           const G4MaterialCutsCouple* material,
+                           const G4Step* step) const = 0;
 
   /** The fractions of energy deposited in consequitive time-bins
    *  for the given calorimeter cell
@@ -243,19 +181,16 @@ protected:
    *  @param fracs the vector of fractions for subsequent time-bins;
    *  @return StatuscCode
    */
-  virtual StatusCode timing
-  ( const double      time      ,
-    const LHCb::CaloCellID& cell      ,
-    CaloSubHit::Time& slot      ,
-    Fractions&        fractions ) const  = 0 ;
-
-protected:
+  virtual bool timing(const double time, const LHCb::CaloCellID& cell,
+                      CaloSubHit::Time& slot,
+                      Fractions& fractions) const = 0;
 
+  protected:
   /** Correction factor from Birk's Law
    *  @param step current G4step
    *  @return the correction factor
    */
-  inline double birkCorrection ( const G4Step* step ) const ;
+  inline double birkCorrection(const G4Step* step) const;
 
   /** Birk's correction for given particle with given kinetic energy
    *  for the given material
@@ -263,10 +198,9 @@ protected:
    *  @param  Ekine    particle kinetic energy
    *  @param  maerial  pointer ot teh material
    */
-  inline double  birkCorrection
-  ( const G4ParticleDefinition* particle ,
-    const double                eKine    ,
-    const G4MaterialCutsCouple* material ) const ;
+  inline double birkCorrection(const G4ParticleDefinition* particle,
+                               const double eKine,
+                               const G4MaterialCutsCouple* material) const;
 
   /** evaluate the correction for Birk's law
    *  @param charge   the charge of the particle
@@ -274,10 +208,8 @@ protected:
    *  @param material the pointer ot teh material
    *  @return the correction coefficient
    */
-  inline double  birkCorrection
-  ( const double      charge   ,
-    const double      dEdX     ,
-    const G4Material* material ) const ;
+  inline double birkCorrection(const double charge, const double dEdX,
+                               const G4Material* material) const;
 
   /** evaluate the correction for Birk's law
    *  @param charge   the charge of the particle
@@ -285,240 +217,77 @@ protected:
    *  @param density  the density ot the material
    *  @return the correction coefficient
    */
-  inline double  birkCorrection
-  ( const double      charge   ,
-    const double      dEdX     ,
-    const double      density  ) const ;
-
-private:
+  inline double birkCorrection(const double charge, const double dEdX,
+                               const double density) const;
 
-  std::string                                 m_endVolumeName       ;
-  const G4LogicalVolume*                      m_end                 ;
+  private:
+  const G4LogicalVolume* m_end;
 
   // definition logical volumes where will be analysed signal
-  Names                                       m_startVolumeNames    ;
-  Volumes                                     m_start               ;
-
-  bool                                        m_volumesLocated      ;
-
-  /// name for created collection
-  std::string                                 m_collectionName      ;
+  Volumes m_start;
 
   // translation table
-  mutable Table                               m_table               ;
-  HitMap                                      m_hitmap              ;
+  mutable Table m_table;
+  HitMap m_hitmap;
 
-  std::string                                 m_caloName            ;
-  const DeCalorimeter*                        m_calo                ;
-  int                                         m_caloID              ;
+  CaloHitsCollection* m_collection;
 
-  double                                      m_zmin                ;
-  double                                      m_zmax                ;
+  bool m_geoBaseInitialized{false};
+  void GeoBaseInitialize();
 
-  CaloHitsCollection*                         m_collection          ;
-
-private:
-
-  /// the vector of histogram names/addresses
-  Names                                      m_histoNames ;
+  public:
   /// all histograms
-  Histos                                     m_histos     ;
-  /// histogram service
-  IHistogramSvc*                             m_histoSvc   ;
-
-private:
+  Histos m_histos;
+  std::string m_endVolumeName{};
+  Names m_startVolumeNames{};
 
   // the first coefficient of Birk's law                    (c1)
-  double                                      m_birk_c1             ;
+  double m_birk_c1{0.013 * CLHEP::g / CLHEP::MeV / CLHEP::cm2};
   // the second coefficient of Birk's law                   (c2)
-  double                                      m_birk_c2             ;
+  double m_birk_c2{9.6E-6 * CLHEP::g * CLHEP::g / CLHEP::MeV / CLHEP::MeV /
+                   CLHEP::cm2 / CLHEP::cm2};
   // the correction to the first coefficient of Birk's law  (c1')
-  double                                      m_birk_c1correction   ;
+  double m_birk_c1correction{0.57142857};
 
-private:
+  double m_zmin{-1 * CLHEP::km};
+  double m_zmax{1 * CLHEP::km};
 
   // the additive correction for the evaluation of t0
-  double   m_dT0    ;
-
+  double m_dT0{0.5 * CLHEP::ns};
+  Gaudi::Accumulators::SummingCounter<size_t>* m_nhits{nullptr};
+  Gaudi::Accumulators::SummingCounter<size_t>* m_nshits{nullptr};
+  Gaudi::Accumulators::SummingCounter<size_t>* m_nslots{nullptr};
+  Gaudi::Accumulators::SummingCounter<double>* m_energy{nullptr};
 };
-// ============================================================================
 
-// ============================================================================
-/** the evaluation of t0 for given calorimetr cell
- *  @param cellID the calorimeter cell identifier
- *  @return "time"-parameter for the given cell
- *           it is evaluated per cell basis in DeCalorimeter
- */
-// ============================================================================
-inline double CaloSensDet::t0       ( const LHCb::CaloCellID& cellID ) const
-{ return calo()->cellTime( cellID ) - dT0 () ; }
-// ============================================================================
-/** helper method to locate the Calorimeter cell to which
- *  G4 point belongs to
- *  @param point G4 point
- *  @retuen calorimeter cell identifier
- */
-// ============================================================================
-inline LHCb::CaloCellID CaloSensDet::cell ( const G4StepPoint* point ) const
-{
-  // current solution!
-  // LHCb::CaloCellID id = calo() -> Cell ( point->GetPosition() ) ;
-  // return id ;
-
-  G4TouchableHistory* tHist  =
-    (G4TouchableHistory*) point->GetTouchable()  ;
-
-  const int nLevel = tHist->GetHistoryDepth() ;
-  CaloSim::Path path ;
-  path.reserve ( nLevel ) ;
-
-  for ( int  level = 0 ; level < nLevel ; ++level )
-  {
-    const G4VPhysicalVolume* pv = tHist->GetVolume ( level ) ;
-    if      (  0     == pv  ) { continue ; }                        // CONTINUE
-    const G4LogicalVolume*   lv = pv -> GetLogicalVolume() ;
-    if      (  0     == lv  ) { continue ; }                        // CONTINUE
-    // start volume ??
-    if      (  m_end == lv  ) { break    ; }                        // BREAK
-    // useful volume ?
-    if      ( !path.empty() ) { path.push_back( pv ) ; }
-    else if ( m_start.end() !=
-              std::find ( m_start.begin () ,
-                          m_start.end   () , lv ) ) { path.push_back( pv ) ; }
-  }
 
-  if ( path.empty() )
-  { Error ( "Volume path is invalid(empty) " ) ; return LHCb::CaloCellID() ; }
-
-  // find the appropriate ID
-  Table::iterator ifound = m_table.find ( path ) ;
-  // already in the table ?
-  if ( m_table.end() != ifound ) { return ifound->second ; }    // RETURN
-
-  // if not: add it into the table!
-  // CLHEP -> ROOT
-  HepGeom::Transform3D mtrx( *(tHist->GetRotation()) , tHist->GetTranslation() );
-  auto heppoint = mtrx * HepGeom::Point3D<double>{};
-  const Gaudi::XYZPoint p ( heppoint.x(),heppoint.y(),heppoint.z() );
-  // get the right cell
-  const CellParam* par = calo()->Cell_( p ) ;
-  if ( 0 == par || !par->valid() )
-  {
-    m_table.insert ( Table::value_type( path , LHCb::CaloCellID() ) ) ;
-    return LHCb::CaloCellID() ;                                   // RETURN
+// CaloDet
+#include "CaloDet/DeCalorimeter.h"
+class CellFromLHCbGeo : public virtual GiGaMessage {
+  protected:
+  CellFromLHCbGeo() = default;
+  virtual ~CellFromLHCbGeo() = default;
+  inline double cellTime(const LHCb::CaloCellID& cellID) const {
+    return m_calo->cellTime(cellID);
+  };
+
+  inline double cellX(const LHCb::CaloCellID& id) const {return m_calo->cellX( id);};
+  inline double cellY(const LHCb::CaloCellID& id) const {return m_calo->cellY( id);};
+  inline double cellSize(const LHCb::CaloCellID& id) const {return m_calo->cellSize(id);}
+
+  inline LHCb::CaloCellID cellID(const Gaudi::XYZPoint& position) const {
+    const CellParam* par = m_calo->Cell_(position);
+    if (0 == par || !par->valid()) {
+      return LHCb::CaloCellID();  // RETURN
+    }
+    return par->cellID();
   }
-  //
-  m_table.insert ( Table::value_type( path , par-> cellID() ) ) ;
-  //
-  return par->cellID() ;
-}
-
-// ============================================================================
-/** evaluate the correction for Birk's law
- *  @param charge   the charge of the particle
- *  @param dEdX     the nominal dEdX in the material
- *  @param density
- *  @return the correction coefficient
- */
-// ============================================================================
-inline double  CaloSensDet::birkCorrection
-( const double      charge   ,
-  const double      dEdX     ,
-  const double      density  ) const
-{
-  const double C1 =
-    fabs( charge )  < 1.5 ? birk_c1() : birk_c1() * birk_c1cor() ;
-  const double C2 = birk_c2() ;
-
-  const double alpha = dEdX/ density ;
-
-  return 1.0 / ( 1.0 + C1 * alpha + C2 * alpha * alpha ) ;
-}
-
-// ============================================================================
-/** evaluate the correction for Birk's law
- *  @param charge   the charge of the particle
- *  @param dEdX     the nominal dEdX in the material
- *  @param material the pointer ot teh material
- *  @return the correction coefficient
- */
-// ============================================================================
-inline double  CaloSensDet::birkCorrection
-( const double      charge   ,
-  const double      dEdX     ,
-  const G4Material* material ) const
-{
-  if ( 0 == material )
-  { Error("birkCorrection(): invalid material " ) ; return 1. ; } // RETURN
-  return birkCorrection( charge , dEdX , material->GetDensity() ) ;
-}
-
-// ============================================================================
-/** Birk's correction for given particle with given kinetic energy
- *  for the given material
- *  @param  particle pointer to particle definition
- *  @param  Ekine    particle kinetic energy
- *  @param  maerial  pointer ot teh material
- */
-// ============================================================================
-inline double CaloSensDet::birkCorrection
-( const G4ParticleDefinition* particle ,
-  const double                eKine    ,
-  const G4MaterialCutsCouple* material ) const
-{
-  if (  0 == particle || 0 == material )
-  { Error("birkCorrection(): invalid parameters " ) ; return 1.0 ; } // RETURN
-
-  const double charge = particle -> GetPDGCharge() ;
-  if ( fabs ( charge ) < 0.1                      ) { return 1.0 ; } // EEUTRN
-
-  // get the nominal dEdX
-  const double dEdX  =
-    G4EnergyLossTables::GetDEDX ( particle , eKine , material ) ;
-
-  // make an actual evaluation
-  return birkCorrection
-    ( charge ,
-      dEdX   ,
-      material->GetMaterial()->GetDensity() ) ;
-}
-
-// ============================================================================
-// Birk's Law
-// ============================================================================
-/** Correction factor from Birk's Law
- *  Factor = 1/(1+C1*dEdx/rho+C2*(dEdx/rho)^2)
- *  Where :
- *      - C1 = 0.013 g/MeV/cm^2 [Ref NIM 80 (1970) 239]
- *      - C2 = 9.6.10^-6 g^2/MeV^2/cm^4
- *      - dEdx in MeV/cm
- *      - rho = density in g/cm^3
- */
-// ============================================================================
-inline double CaloSensDet::birkCorrection ( const G4Step* step ) const
-{
-  if ( !step ) { return 1 ; }                               // RETURN
-
-  // Track
-  const G4Track* track  = step->GetTrack() ;
-  const double charge   = track->GetDefinition()->GetPDGCharge()  ;
-
-  // Only for charged tracks
-  if ( fabs( charge ) < 0.1 ) { return 1 ; }                 // RETURN
-
-  // make an actual evaluation
-  return birkCorrection
-    ( track->GetDefinition         () ,
-      track->GetKineticEnergy      () ,
-      track->GetMaterialCutsCouple () ) ;
-}
-// ============================================================================
-
-
 
+  public:
+  // Need to be set by the corresponding factory that has access to
+  // the Gaudi based functionality
+  const DeCalorimeter* m_calo{nullptr};
+  int m_caloID{0};
+};
 
-// ============================================================================
-// The END
-// ============================================================================
-#endif  ///< GAUSSCALO_CaloSensDet_H
-// ============================================================================
+#include "CaloSensDet.icpp"
diff --git a/Sim/GaussCalo/src/CaloSensDet.icpp b/Sim/GaussCalo/src/CaloSensDet.icpp
new file mode 100755
index 0000000000000000000000000000000000000000..5a00112da9ed330758067c6ca8c89cbede94a27c
--- /dev/null
+++ b/Sim/GaussCalo/src/CaloSensDet.icpp
@@ -0,0 +1,417 @@
+// $Id: CaloSensDet.cpp,v 1.24 2008-07-11 10:47:44 robbep Exp $
+// Include files
+
+// SRD & STD
+#include <algorithm>
+#include <sstream>
+#include <vector>
+
+// LHCbDefintions
+#include "CLHEP/Geometry/Point3D.h"
+
+// from Gaudi
+#include "GaudiKernel/IDataProviderSvc.h"
+#include "GaudiKernel/IHistogramSvc.h"
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/Point3DTypes.h"
+#include "GaudiKernel/SmartDataPtr.h"
+#include "GaudiKernel/Stat.h"
+
+// GaussTools
+#include "GiGaMTCoreTruth/GaussinoTrackInformation.h"
+
+// Geant4
+#include "Geant4/G4LogicalVolume.hh"
+#include "Geant4/G4LogicalVolumeStore.hh"
+#include "Geant4/G4Material.hh"
+#include "Geant4/G4MaterialCutsCouple.hh"
+#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4Step.hh"
+#include "Geant4/G4TouchableHistory.hh"
+#include "Geant4/G4VPhysicalVolume.hh"
+
+// local
+#include "CaloHit.h"
+#include "CaloSensDet.h"
+#include "CaloSimHash.h"
+
+// AIDA
+#include "AIDA/IHistogram1D.h"
+
+// Boost
+#include "boost/format.hpp"
+
+template <typename CELLGETTER>
+CaloSensDet<CELLGETTER>::CaloSensDet(const std::string& name)
+    : G4VSensitiveDetector(name) {
+  collectionName.insert("Hits");
+}
+// ============================================================================
+
+// ============================================================================
+/** the evaluation of t0 for given calorimetr cell
+ *  @param cellID the calorimeter cell identifier
+ *  @return "time"-parameter for the given cell
+ *           it is evaluated per cell basis in DeCalorimeter
+ */
+// ============================================================================
+template <typename CELLGETTER>
+double CaloSensDet<CELLGETTER>::t0(const LHCb::CaloCellID& cellID) const {
+  return this->cellTime(cellID) - dT0();
+}
+
+// ============================================================================
+/** evaluate the correction for Birk's law
+ *  @param charge   the charge of the particle
+ *  @param dEdX     the nominal dEdX in the material
+ *  @param density
+ *  @return the correction coefficient
+ */
+// ============================================================================
+template <typename CELLGETTER>
+double CaloSensDet<CELLGETTER>::birkCorrection(const double charge,
+                                               const double dEdX,
+                                               const double density) const {
+  const double C1 = fabs(charge) < 1.5 ? birk_c1() : birk_c1() * birk_c1cor();
+  const double C2 = birk_c2();
+
+  const double alpha = dEdX / density;
+
+  return 1.0 / (1.0 + C1 * alpha + C2 * alpha * alpha);
+}
+
+// ============================================================================
+/** method from G4
+ *  (Called at the begin of each event)
+ *  @see G4VSensitiveDetector
+ *  @param HCE pointer to hit collection of current event
+ */
+// ============================================================================
+template <typename CELLGETTER>
+void CaloSensDet<CELLGETTER>::Initialize(G4HCofThisEvent* HCE) {
+  //
+  if (!this->m_geoBaseInitialized) {
+    this->GeoBaseInitialize();
+  }
+  if (!this->m_geoBaseInitialized) {
+    std::runtime_error("Could not locate volumes!");
+  }
+  //
+  m_collection =
+      new CaloHitsCollection(SensitiveDetectorName, collectionName[0]);
+  //
+  std::string hit_location = SensitiveDetectorName + "/" + collectionName[0];
+
+  debug("Registering location at " + hit_location);
+  int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(hit_location);
+
+  HCE->AddHitsCollection(HCID, m_collection);
+
+  m_hitmap.clear();
+}
+
+// ============================================================================
+/** evaluate the correction for Birk's law
+ *  @param charge   the charge of the particle
+ *  @param dEdX     the nominal dEdX in the material
+ *  @param material the pointer ot teh material
+ *  @return the correction coefficient
+ */
+// ============================================================================
+template <typename CELLGETTER>
+double CaloSensDet<CELLGETTER>::birkCorrection(
+    const double charge, const double dEdX, const G4Material* material) const {
+  if (0 == material) {
+    error("birkCorrection(): invalid material ");
+    return 1.;
+  }  // RETURN
+  return birkCorrection(charge, dEdX, material->GetDensity());
+}
+
+// ============================================================================
+/** Birk's correction for given particle with given kinetic energy
+ *  for the given material
+ *  @param  particle pointer to particle definition
+ *  @param  Ekine    particle kinetic energy
+ *  @param  maerial  pointer ot teh material
+ */
+// ============================================================================
+template <typename CELLGETTER>
+double CaloSensDet<CELLGETTER>::birkCorrection(
+    const G4ParticleDefinition* particle, const double eKine,
+    const G4MaterialCutsCouple* material) const {
+  if (0 == particle || 0 == material) {
+    error("birkCorrection(): invalid parameters ");
+    return 1.0;
+  }  // RETURN
+
+  const double charge = particle->GetPDGCharge();
+  if (fabs(charge) < 0.1) {
+    return 1.0;
+  }  // EEUTRN
+
+  // get the nominal dEdX
+  const double dEdX = G4EnergyLossTables::GetDEDX(particle, eKine, material);
+
+  // make an actual evaluation
+  return birkCorrection(charge, dEdX, material->GetMaterial()->GetDensity());
+}
+
+// ============================================================================
+// Birk's Law
+// ============================================================================
+/** Correction factor from Birk's Law
+ *  Factor = 1/(1+C1*dEdx/rho+C2*(dEdx/rho)^2)
+ *  Where :
+ *      - C1 = 0.013 g/MeV/cm^2 [Ref NIM 80 (1970) 239]
+ *      - C2 = 9.6.10^-6 g^2/MeV^2/cm^4
+ *      - dEdx in MeV/cm
+ *      - rho = density in g/cm^3
+ */
+// ============================================================================
+template <typename CELLGETTER>
+double CaloSensDet<CELLGETTER>::birkCorrection(const G4Step* step) const {
+  if (!step) {
+    return 1;
+  }  // RETURN
+
+  // Track
+  const G4Track* track = step->GetTrack();
+  const double charge = track->GetDefinition()->GetPDGCharge();
+
+  // Only for charged tracks
+  if (fabs(charge) < 0.1) {
+    return 1;
+  }  // RETURN
+
+  // make an actual evaluation
+  return birkCorrection(track->GetDefinition(), track->GetKineticEnergy(),
+                        track->GetMaterialCutsCouple());
+}
+
+template <typename CELLGETTER>
+LHCb::CaloCellID CaloSensDet<CELLGETTER>::cell(const G4StepPoint* point) const {
+  G4TouchableHistory* tHist = (G4TouchableHistory*)point->GetTouchable();
+
+  const int nLevel = tHist->GetHistoryDepth();
+  CaloSim::Path path;
+  path.reserve(nLevel);
+
+  for (int level = 0; level < nLevel; ++level) {
+    const G4VPhysicalVolume* pv = tHist->GetVolume(level);
+    if (0 == pv) {
+      continue;
+    }  // CONTINUE
+    const G4LogicalVolume* lv = pv->GetLogicalVolume();
+    if (0 == lv) {
+      continue;
+    }  // CONTINUE
+    // start volume ??
+    if (m_end == lv) {
+      break;
+    }  // BREAK
+    // useful volume ?
+    if (!path.empty()) {
+      path.push_back(pv);
+    } else if (m_start.end() != std::find(m_start.begin(), m_start.end(), lv)) {
+      path.push_back(pv);
+    }
+  }
+
+  if (path.empty()) {
+    error("Volume path is invalid(empty) ");
+    return LHCb::CaloCellID();
+  }
+
+  // find the appropriate ID
+  Table::iterator ifound = m_table.find(path);
+  // already in the table ?
+  if (m_table.end() != ifound) {
+    return ifound->second;
+  }  // RETURN
+
+  // if not: add it into the table!
+  // CLHEP -> ROOT
+  HepGeom::Transform3D mtrx(*(tHist->GetRotation()), tHist->GetTranslation());
+  auto heppoint = mtrx * HepGeom::Point3D<double>{};
+  const Gaudi::XYZPoint p(heppoint.x(), heppoint.y(), heppoint.z());
+
+  // get the right cell id
+  auto id = this->cellID(p);
+  m_table.insert(Table::value_type(path, id));
+
+  return id;
+}
+
+// ============================================================================
+/** method from G4
+ *  (Called at the end of each event)
+ *  @see G4VSensitiveDetector
+ *  @param HCE pointer to hit collection of current event
+ */
+// ============================================================================
+template <typename CELLGETTER>
+void CaloSensDet<CELLGETTER>::EndOfEvent(G4HCofThisEvent* /* HCE */) {
+  /// clear the map
+  m_hitmap.clear();
+
+  if (0 == m_collection) {
+    warning(" EndOfEvent(): HitCollection points to NULL ");
+    return;
+  }
+  typedef std::vector<CaloHit*> Hits;
+  const Hits* hits = m_collection->GetVector();
+  if (0 == hits) {
+    error(" EndOfEvent(): HitVector* points to NULL ");
+    return;
+  }
+
+  // initialize counters
+  const size_t nhits = hits->size();
+  size_t nshits = 0;
+  size_t nslots = 0;
+  double energy = 0;
+
+  // the loop over all hits
+  for (Hits::const_iterator ihit = hits->begin(); hits->end() != ihit; ++ihit) {
+    const CaloHit* hit = *ihit;
+    if (0 == hit) {
+      continue;
+    }  // CONTINUE
+    nshits += hit->size();
+    nslots += hit->totalSize();
+    energy += hit->energy();
+  }
+
+  energy /= CLHEP::GeV;  // NB: rescale to GeV
+
+  if (m_nhits) (*m_nhits) += nhits;
+  if (m_nshits) (*m_nshits) += nshits;
+  if (m_nslots) (*m_nslots) += nslots;
+  if (m_energy) (*m_energy) += energy;
+
+  if (printDebug()) {
+    always(boost::str(
+        boost::format(" #Hits=%5d #SubHits=%5d #Slots=%5d Energy=%8.3g[GeV] ") %
+        nhits % nshits % nslots % energy));
+  }
+}
+
+// ============================================================================
+/** process the hit
+ *  @param step     pointer to current Geant4 step
+ *  @param history  pointert to touchable history
+ */
+// ============================================================================
+template <typename CELLGETTER>
+bool CaloSensDet<CELLGETTER>::ProcessHits(G4Step* step,
+                                          G4TouchableHistory* /* history */) {
+  if (0 == step) {
+    return false;
+  }
+  ///
+  const double deposit = step->GetTotalEnergyDeposit();
+  if (deposit <= 0) {
+    return false;
+  }  // RETURN
+
+  const G4Track* const track = step->GetTrack();
+  const int trackID = track->GetTrackID();
+  const G4ParticleDefinition* const particle = track->GetDefinition();
+  const double charge = particle->GetPDGCharge();
+
+  if (0 == int(charge * 10)) {
+    return false;
+  }  // RETURN
+
+  const G4StepPoint* const preStep = step->GetPreStepPoint();
+  const HepGeom::Point3D<double>& prePoint = preStep->GetPosition();
+  const double time = preStep->GetGlobalTime();
+  const G4MaterialCutsCouple* const material = preStep->GetMaterialCutsCouple();
+
+  const LHCb::CaloCellID cellID = cell(preStep);
+  if (LHCb::CaloCellID() == cellID) {
+    return false;
+  }
+
+  // get the existing hit
+  CaloHit*& hit = m_hitmap[cellID];
+  if (0 == hit) {
+    // create new hit
+    hit = new CaloHit(cellID);
+    // add it into collection
+    m_collection->insert(hit);
+  }
+
+  // check the status of the track
+  auto info = GaussinoTrackInformation::Get();
+  if (0 == info) {
+    error("Invalid Track information");
+    return false;
+  }  // RETURN
+
+  // ID of the track to be stored
+  int sTrackID = track->GetParentID();
+
+  // already marked to be stored:
+  if (info->storeTruth()) {
+    sTrackID = trackID;
+  } else {
+    // z-position of production vertex
+    const double z0 = track->GetVertexPosition().z();
+    // outside the "forbidden zone" ?
+    if (z0 < zMin() || z0 > zMax()) {
+      sTrackID = trackID;
+    }
+  }
+
+  // Does the hit exist for the given track?
+  CaloSubHit*& sub = hit->hit(sTrackID);  // ATTENTION
+  // create new subhit if needed
+  if (0 == sub) {
+    sub = new CaloSubHit(cellID, sTrackID);
+  }
+  // update the track information
+  if (trackID == sTrackID) {
+    info->addToHits(sub);
+  }
+
+  // perform the specific sub-detector action
+  bool sc = fillHitInfo(sub, prePoint, time, deposit, track, particle, material,
+                        step);
+
+  if (!sc) {
+    error("The SubHit information is not filled!");
+  }
+
+  return true;
+}
+
+// ============================================================================
+/** helpful method to locate start and end volumes
+ *  @return status code
+ */
+// ============================================================================
+template <typename CELLGETTER>
+void CaloSensDet<CELLGETTER>::GeoBaseInitialize() {
+  // locate start volumes
+  for (auto& vol : m_startVolumeNames) {
+    // look through converted volumes
+    const G4LogicalVolume* lv =
+        G4LogicalVolumeStore::GetInstance()->GetVolume(vol);
+    if (0 == lv) {
+      throw std::runtime_error(std::string(__PRETTY_FUNCTION__) + "G4LogicalVolume* points to 0 for " + (vol));
+    }
+    m_start.push_back(lv);
+  }
+  if (m_start.empty()) {
+    throw std::runtime_error(std::string(__PRETTY_FUNCTION__) + "Size of 'StartVolumes' is 0 ");
+  }
+  // locate end volume : look through converted volumes
+  m_end = G4LogicalVolumeStore::GetInstance()->GetVolume(m_endVolumeName);
+  if (0 == m_end) {
+    throw std::runtime_error(std::string(__PRETTY_FUNCTION__) + "G4LogicalVolume* points to 0 for '" +
+                             m_endVolumeName + "'");
+  }
+  m_geoBaseInitialized = true;
+}
diff --git a/Sim/GaussCalo/src/CaloSensDetFAC.cpp b/Sim/GaussCalo/src/CaloSensDetFAC.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussCalo/src/CaloSensDetFAC.h b/Sim/GaussCalo/src/CaloSensDetFAC.h
new file mode 100755
index 0000000000000000000000000000000000000000..0c3ff731a44a66e7c2afa8e0163685ea84deccee
--- /dev/null
+++ b/Sim/GaussCalo/src/CaloSensDetFAC.h
@@ -0,0 +1,130 @@
+#pragma once
+
+#include "GiGaMTFactories/GiGaMTG4SensDetFactory.h"
+
+// Geant4 physics lists
+#include "CaloSensDet.h"
+
+// Templated base class for all CALO sensitive detector factories
+// to pass common properties to the object. First the very common
+// base class that encapsulates the properties needed independent
+// of the templated geometry access interface.
+
+template <typename CALO>
+class CaloSensDetBaseFAC : public GiGaMTG4SensDetFactory<CALO> {
+  Gaudi::Property<std::string> m_endVolumeName{this, "EndVolume", ""};
+  Gaudi::Property<std::vector<std::string>> m_startVolumeNames{
+      this, "StartVolumes", {}};
+
+  // the first coefficient of Birk's law                    (c1)
+  Gaudi::Property<double> m_birk_c1{this, "BirkC1",
+                                    0.013 * CLHEP::g / CLHEP::MeV / CLHEP::cm2};
+  // the second coefficient of Birk's law                   (c2)
+  Gaudi::Property<double> m_birk_c2{this, "BirkC2",
+                                    9.6E-6 * CLHEP::g* CLHEP::g / CLHEP::MeV /
+                                        CLHEP::MeV / CLHEP::cm2 / CLHEP::cm2};
+  // the correction to the first coefficient of Birk's law  (c1')
+  Gaudi::Property<double> m_birk_c1correction{this, "BirkC1cor", 0.57142857};
+
+  Gaudi::Property<double> m_zmin{this, "zMin", -1 * CLHEP::km};
+  Gaudi::Property<double> m_zmax{this, "zMax", 1 * CLHEP::km};
+
+  // the additive correction for the evaluation of t0
+  Gaudi::Property<double> m_dT0{this, "dT0", 0.5 * CLHEP::ns};
+
+  /// the vector of histogram names/addresses
+  Gaudi::Property<std::vector<std::string>> m_histoNames{
+      this, "Histograms", {}};
+  ServiceHandle<IHistogramSvc> m_histoSvc{this, "HistogramDataSvc",
+                                          "HistogramDataSvc"};
+
+  mutable Gaudi::Accumulators::SummingCounter<size_t> m_nhits{this, "#hits"};
+  mutable Gaudi::Accumulators::SummingCounter<size_t> m_nshits{this, "#subhits"};
+  mutable Gaudi::Accumulators::SummingCounter<size_t> m_nslots{this, "#tslots"};
+  mutable Gaudi::Accumulators::SummingCounter<double> m_energy{this, "#energy"};
+
+  public:
+  virtual ~CaloSensDetBaseFAC() = default;
+  using gaussino_base_class = GiGaMTG4SensDetFactory<CALO>;
+  using typename gaussino_base_class::GiGaMTG4SensDetFactory;
+  virtual CALO* construct() const override {
+    auto tmp = gaussino_base_class::construct();
+    tmp->m_endVolumeName = m_endVolumeName;
+    tmp->m_startVolumeNames = m_startVolumeNames;
+    tmp->m_birk_c1 = m_birk_c1;
+    tmp->m_birk_c2 = m_birk_c2;
+    tmp->m_birk_c1correction = m_birk_c1correction;
+    tmp->m_zmin = m_zmin;
+    tmp->m_zmax = m_zmax;
+    tmp->m_dT0 = m_dT0;
+    tmp->m_histos = m_histos;
+    tmp->m_nhits = &m_nhits;
+    tmp->m_nshits = &m_nshits;
+    tmp->m_nslots = &m_nslots;
+    tmp->m_energy = &m_energy;
+    return tmp;
+  }
+  StatusCode initialize() override {
+    auto sc = gaussino_base_class::initialize();
+
+    m_histoSvc.retrieve();
+    {  // load all input histos
+      for (auto& histo : m_histoNames) {
+        SmartDataPtr<IHistogram1D> pHist(m_histoSvc.get(), histo);
+        IHistogram1D* hist = pHist;
+        if (0 == hist) {
+          return this->Error("Cannot load histogram '" + (histo) + "'");
+        }
+        m_histos.push_back(hist);
+      }
+      if (m_histos.empty()) {
+        this->warning() << "Empty vector of input time-histograms" << endmsg;
+      }
+    }
+    return sc;
+  }
+
+  private:
+  std::vector<AIDA::IHistogram1D*> m_histos;
+};
+
+// Actual version that can be specialised depending on the used base
+// class of CALO that handles the geometry access (for CellID retrieval)
+
+template <typename CALO, typename dummy = void>
+class CaloSensDetFAC : public CaloSensDetBaseFAC<CALO> {
+  public:
+  virtual ~CaloSensDetFAC() = default;
+  using base_class = CaloSensDetBaseFAC<CALO>;
+  using base_class::CaloSensDetBaseFAC;
+  virtual CALO* construct() const override { return base_class::construct(); }
+};
+
+template <typename T>
+using usesLHCbGeo =
+    typename std::enable_if<std::is_base_of<CellFromLHCbGeo, T>::value>::type;
+
+template <typename CALO>
+class CaloSensDetFAC<CALO, usesLHCbGeo<CALO>>
+    : public CaloSensDetBaseFAC<CALO> {
+  Gaudi::Property<std::string> m_caloName{this, "Detector",
+                                          DeCalorimeterLocation::Ecal};
+
+  public:
+  virtual ~CaloSensDetFAC() = default;
+  using base_class = CaloSensDetBaseFAC<CALO>;
+  using base_class::CaloSensDetBaseFAC;
+  virtual CALO* construct() const override {
+    auto tmp = base_class::construct();
+    tmp->m_calo = this->template getDet<DeCalorimeter>(m_caloName);
+    if (0 == tmp->m_calo) {
+      throw std::runtime_error("Could not locate CALO " + m_caloName);
+    }
+    tmp->m_caloID = CaloCellCode::CaloNumFromName(m_caloName);
+
+    if (0 > tmp->m_caloID) {
+      throw std::runtime_error("Invalid detector name/number!");
+    }
+    return tmp;
+  }
+};
diff --git a/Sim/GaussCalo/src/CaloSubHit.cpp b/Sim/GaussCalo/src/CaloSubHit.cpp
old mode 100755
new mode 100644
index 9e645742088b990a90471716c9c9dd654a499e53..db3b4f4eb031f5c011763f9b8c30667982914e66
--- a/Sim/GaussCalo/src/CaloSubHit.cpp
+++ b/Sim/GaussCalo/src/CaloSubHit.cpp
@@ -1,135 +1,3 @@
-// $Id: CaloSubHit.cpp,v 1.4 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.3  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.2  2002/12/13 16:52:57  ibelyaev
-//  put updated versions of the packages
-//
-// Revision 1.1  2002/12/07 14:41:44  ibelyaev
-//  add new Calo stuff
-//
-// ============================================================================
-// Include files
-// GiGa
-#include "GiGa/GiGaUtil.h"
-// Geant4 
-#include "Geant4/G4Allocator.hh"
-#include "Geant4/G4VHit.hh"
-// G4 
-// local
 #include "CaloSubHit.h"
 
-// ============================================================================
-/** @file 
- *  Implementation file for all non-inlined methods of class CaloSubHit
- *
- *  @author Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date   2002-12-03
- */
-// ============================================================================
-
-namespace CaloSubHitLocal
-{
-  // ==========================================================================
-  /** @var  s_Allocator
-   *  allocator to make more efficient creation delete of CaloSubHits objects  
-   */
-  // ==========================================================================
-  G4Allocator<CaloSubHit>            s_Allocator ;
-  // ==========================================================================
-  
-  // ==========================================================================
-  /** @var s_Counter 
-   *  statsic instace counter for all functions 
-   */
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  static GiGaUtil::InstanceCounter<CaloSubHit> s_Counter   ;
-#endif 
-  // ==========================================================================
-}
-
-
-
-// ============================================================================
-/** Standard constructor
- *  @param cellID  cellID  of the detector cell  
- *  @param trackID trackID of the particle
- */
-// ============================================================================
-CaloSubHit::CaloSubHit( const LHCb::CaloCellID& cellID  , 
-                        const int         trackID )
-  : GaussHitBase (        )  
-  , m_cellID     ( cellID ) 
-  , m_map        (        ) 
-{ 
-  setTrackID( trackID ) ;
-#ifdef GIGA_DEBUG
-  CaloSubHitLocal::s_Counter.increment () ;
-#endif 
-}
-
-
-// ============================================================================
-/** copy constructor 
- *  @param right object to be copied 
- */
-// ============================================================================
-CaloSubHit::CaloSubHit( const CaloSubHit& right ) 
-  : GaussHitBase( right    ) 
-  , m_cellID ( right.cellID() ) 
-  , m_map    ( right.m_map    ) 
-{
-#ifdef GIGA_DEBUG
-  CaloSubHitLocal::s_Counter.increment () ;
-#endif 
-}
-
-
-/// destructor 
-// ============================================================================
-CaloSubHit::~CaloSubHit() 
-{ 
-  m_map.clear() ; 
-#ifdef GIGA_DEBUG
-  CaloSubHitLocal::s_Counter.decrement () ;
-#endif 
-}
-
-
-// ============================================================================
-/// Clone method 
-// ============================================================================
-CaloSubHit* CaloSubHit::clone() const 
-{ 
-  return new CaloSubHit( *this ); 
-}
-
-
-// ============================================================================
-/// overloaded 'new' operator 
-// ============================================================================
-void* CaloSubHit::operator new(size_t)
-{
-  void *hit  ;
-  hit = (void *) CaloSubHitLocal::s_Allocator.MallocSingle () ;
-  return hit ;
-}
-
-
-// ============================================================================
-/// overloaded 'delete' operator 
-// ============================================================================
-void CaloSubHit::operator delete( void *hit )
-{ 
-  CaloSubHitLocal::s_Allocator.FreeSingle( (CaloSubHit*) hit ); 
-}
-
-
-// ============================================================================
-// The END 
-// ============================================================================
+G4ThreadLocal G4Allocator<CaloSubHit>* aCaloSubHitAllocator{nullptr};
diff --git a/Sim/GaussCalo/src/CaloSubHit.h b/Sim/GaussCalo/src/CaloSubHit.h
index 1da2c19bb6cec1aa27a6d7ede6d35b4aa736e690..2f6430e89c235542a5fb9f66f3b0e87b85b0b589 100755
--- a/Sim/GaussCalo/src/CaloSubHit.h
+++ b/Sim/GaussCalo/src/CaloSubHit.h
@@ -1,258 +1,205 @@
-// $Id: CaloSubHit.h,v 1.7 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.6  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.5  2003/12/09 08:28:39  ibelyaev
-//  fix for missing != operator for CaloCellID class
-//
-// Revision 1.4  2003/07/22 19:05:33  ibelyaev
-//  improve doxygen documentation
-//
-// Revision 1.3  2003/07/08 19:40:57  ibelyaev
-//  Sensitive Plane Detector + improved printout
-//
-// Revision 1.2  2002/12/13 16:52:57  ibelyaev
-//  put updated versions of the packages
-//
-// Revision 1.2  2002/12/07 21:19:14  ibelyaev
-//  few optimization updates
-//
-// Revision 1.1  2002/12/07 14:41:44  ibelyaev
-//  add new Calo stuff
-//
-// ============================================================================
-#ifndef CALOSIM_CALOSUBHIT_H 
-#define CALOSIM_CALOSUBHIT_H 1
+#pragma once
 // Kernel
 #include "Kernel/CaloCellID.h"
-// GiGa 
+// GiGa
 #include <unordered_map>
-#include "GiGa/GiGaUtil.h"
 // Include files
-#include "GaussTools/GaussHitBase.h"
-// Local 
+#include "GaudiKernel/StatusCode.h"
+#include "GiGaMTCoreDet/GaussHitBase.h"
+// Local
 #include "CaloSimHash.h"
+#include "Geant4/G4Allocator.hh"
 
 /** @class CaloSubHit CaloSubHit.h
- * 
+ *
  *  Elementary "sub-hit" for calorimeter devices.
- *  The class represents an list of energy depositions 
+ *  The class represents an list of energy depositions
  *  from given particle in the given calorimeter cell.
  *
- *  These objects are not expected to be stored directly 
- *  in Geant4 hits collections. 
- *  These objects are used to be collected in objects of type 
- *  <tt>CaloHit</tt> 
+ *  These objects are not expected to be stored directly
+ *  in Geant4 hits collections.
+ *  These objects are used to be collected in objects of type
+ *  <tt>CaloHit</tt>
  *
  *  @see CaloHit
  *  @see CaloSubHit
  *  @author Vanya Belyaev Ivan.Belyaev@itep.ru
  *  @date   2002-12-03
  */
-class CaloSubHit : public GaussHitBase 
-{
-public:
-  
-  /// type for the hits "Energy" deposition 
-  typedef double Energy                     ;  
-  /// type for "time" index  
-  typedef char   Time                       ;
-  // actual type of 
-  typedef std::unordered_map<Time,Energy> TheMap   ;
-  // iterator type 
-  typedef TheMap::const_iterator   iterator ;
+class CaloSubHit : public Gaussino::HitBase {
+  public:
+  /// type for the hits "Energy" deposition
+  typedef double Energy;
+  /// type for "time" index
+  typedef char Time;
+  // actual type of
+  // FIXME: Use thread-local allocator
+  typedef std::unordered_map<Time, Energy> TheMap;
+  // iterator type
+  typedef TheMap::const_iterator iterator;
 
-public:
-  
+  public:
   /** Standard constructor
-   *  @param cellID  cellID  of the detector cell  
+   *  @param cellID  cellID  of the detector cell
    *  @param trackID trackID of the particle
    */
-  CaloSubHit ( const LHCb::CaloCellID& cellID  = LHCb::CaloCellID() , 
-               const int         trackID = 0            ) ;
-  
-  /** copy constructor 
-   *  @param right object to be copied 
+  CaloSubHit(const LHCb::CaloCellID& cellID = LHCb::CaloCellID(),
+             const int trackID = 0)
+      : Gaussino::HitBase{}, m_cellID{cellID}, m_map{} {
+    m_trackID = trackID;
+  }
+
+  /** copy constructor
+   *  @param right object to be copied
    */
-  CaloSubHit ( const CaloSubHit& right                  ) ;
-  
-  /// clone method (virtual constructor) 
-  virtual CaloSubHit* clone() const ;
-  
-  /// destructor 
-  virtual ~CaloSubHit() ;
-  
-  void* operator new    ( size_t    ) ;
-  void  operator delete ( void *hit ) ;
-  
-  /// access to cell ID for given hit  
-  const LHCb::CaloCellID& cellID() const          { return m_cellID        ; }  
-  // set new cell ID for given hit 
-  void setCellID ( const LHCb::CaloCellID& cell ) {        m_cellID = cell ; }
-  
+  CaloSubHit(const CaloSubHit& right)
+      : Gaussino::HitBase(right),
+        m_cellID(right.cellID()),
+        m_map(right.m_map) {}
+
+  // virtual ~CaloSubHit() = default;
+
+  ///// clone method (virtual constructor)
+  // virtual CaloSubHit* clone() const ;
+
+  void* operator new(size_t);
+  void operator delete(void* hit);
+
+  /// access to cell ID for given hit
+  const LHCb::CaloCellID& cellID() const { return m_cellID; }
+  // set new cell ID for given hit
+  void setCellID(const LHCb::CaloCellID& cell) { m_cellID = cell; }
+
   /** add energy deposition for given hit (safe method)
    *  Error flags:
-   *   - inconsistent track ID :  300 
+   *   - inconsistent track ID :  300
    *   - inconsistent cell  ID :  301
-   * 
-   *  @code 
+   *
+   *  @code
    *
    *  CaloSubHit*        hit   = ... ;
    *  CaloSubHit::Time   time  = ... ;
    *  CaloSubHit::Energy e     = ... ;
    *  const int          track = ... ;
    *  const LHCb::CaloCellID&  cell  = ... ;
-   * 
+   *
    *  StatusCode sc  = hit->add( track , cell , time , energy ) ;
-   *  if( sc.isFailure() ) { .... } 
+   *  if( sc.isFailure() ) { .... }
+   *
+   *  @endcode
    *
-   *  @endcode 
-   * 
    *  @param track  trackID for energy deposition
    *  @param cell   cellID  for the detector cell
-   *  @param time   the time of the energy deposition 
-   *  @param energy deposition itself 
-   *  @return status code 
+   *  @param time   the time of the energy deposition
+   *  @param energy deposition itself
+   *  @return status code
    */
-  StatusCode add ( const int         track , 
-                   const LHCb::CaloCellID& cell    , 
-                   const Time        time    , 
-                   const Energy      energy  )
-  {
-    if (    trackID () != track   ) { return StatusCode( 300 ) ; }
-    if ( !( cellID  () == cell  ) ) { return StatusCode( 301 ) ; }    
-    return add( time , energy );
+  StatusCode add(const int track, const LHCb::CaloCellID& cell, const Time time,
+                 const Energy energy) {
+    if (trackID() != track) {
+      return StatusCode(300);
+    }
+    if (!(cellID() == cell)) {
+      return StatusCode(301);
+    }
+    return add(time, energy);
   };
-  
+
   /** add energy deposition for given hit (fast method)
-   * 
-   *  @code 
+   *
+   *  @code
    *
    *  CaloSubHit*        hit  = ... ;
    *  CaloSubHit::Time   time = ... ;
    *  CaloSubHit::Energy e    = ... ;
-   * 
+   *
    *  hit->add( time , energy ) ;
    *
-   *  @endcode 
-   * 
+   *  @endcode
+   *
    *  @param track  trackID for energy deposition
    *  @param cell   cellID  for the detector cell
-   *  @param time   the time of the energy deposition 
-   *  @param energy deposition itself 
-   *  @return status code 
+   *  @param time   the time of the energy deposition
+   *  @param energy deposition itself
+   *  @return status code
    */
-  StatusCode add ( const Time   time   , 
-                   const Energy energy )
-  {
-    m_map[ time ] += energy ;
-    return StatusCode::SUCCESS ;
+  StatusCode add(const Time time, const Energy energy) {
+    m_map[time] += energy;
+    return StatusCode::SUCCESS;
   };
-  
+
   /** access for map iterator "begin" (const)
-   *  
-   *  @code 
-   *  
+   *
+   *  @code
+   *
    *  CaloSubHit* hit = ... ;
    *
-   *  for( CaloSubHit::iterator entry = hit->begin() ; 
-   *       hit->end() != entry ; ++entry ) 
+   *  for( CaloSubHit::iterator entry = hit->begin() ;
+   *       hit->end() != entry ; ++entry )
    *    {
    *       CaloSubHit::Energy e = entry->first   ;
-   *       CaloSubHit::Time   t = entry->second  ; 
+   *       CaloSubHit::Time   t = entry->second  ;
    *    }
-   *  
-   *   @endcode 
-   *   @return 'begin' iterator to the sequence of entries 
+   *
+   *   @endcode
+   *   @return 'begin' iterator to the sequence of entries
    */
-  iterator begin   () const { return m_map.begin () ; }
+  iterator begin() const { return m_map.begin(); }
   /** access for map iterator "end"   (const)
-   *  
-   *  @code 
-   *  
+   *
+   *  @code
+   *
    *  CaloSubHit* hit = ... ;
    *
-   *  for( CaloSubHit::iterator entry = hit->begin() ; 
-   *       hit->end() != entry ; ++entry ) 
+   *  for( CaloSubHit::iterator entry = hit->begin() ;
+   *       hit->end() != entry ; ++entry )
    *    {
    *       CaloSubHit::Energy e = entry->first   ;
-   *       CaloSubHit::Time   t = entry->second  ; 
+   *       CaloSubHit::Time   t = entry->second  ;
    *    }
-   *  
-   *   @endcode 
-   *   @return 'end' iterator to teh sequence of entries 
+   *
+   *   @endcode
+   *   @return 'end' iterator to teh sequence of entries
    */
-  iterator end     () const { return m_map.end   () ; }
-  
-  /// number of entries/map size 
-  size_t   size    () const { return m_map.size  () ; }
-  size_t   entries () const { return       size  () ; }
-  
+  iterator end() const { return m_map.end(); }
+
+  /// number of entries/map size
+  size_t size() const { return m_map.size(); }
+  size_t entries() const { return size(); }
+
   /** overall subhit evergy  (integrated over the time )
-   * 
-   *  @code 
-   *  
+   *
+   *  @code
+   *
    *  CaloSubHit* hit = ... ;
    *  CaloSubHit::Energy e = hit->energy() ;
-   * 
-   *  @endcode 
-   *  @return total subhit energy (total energy deposition from given particle 
+   *
+   *  @endcode
+   *  @return total subhit energy (total energy deposition from given particle
    *          in the given calorimeter cell)
    */
-  Energy   energy  () const 
-  {
-    Energy e = 0 ;
-    for( iterator entry = begin() ; end() != entry ; ++entry ) 
-      { e += entry->second ; } 
-    return e ;
+  Energy energy() const {
+    Energy e = 0;
+    for (iterator entry = begin(); end() != entry; ++entry) {
+      e += entry->second;
+    }
+    return e;
   };
-  
-private:
-  
-  LHCb::CaloCellID  m_cellID ;
-  TheMap      m_map    ;
-  
+
+  private:
+  LHCb::CaloCellID m_cellID;
+  TheMap m_map;
 };
-// ============================================================================
 
-// ============================================================================
-/** @fn  caloSubHit
- *  Fast cast of G4VHit interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHit interface 
- *  @return cast (dynamic or static) to CaloSubHit
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline CaloSubHit* caloSubHit( G4VHit* g4 )
-{
-  GiGaUtil::FastCast<G4VHit,CaloSubHit> cast ;
-  return cast( g4 );  
-}
-// ============================================================================
+extern G4ThreadLocal G4Allocator<CaloSubHit>* aCaloSubHitAllocator;
 
-// ============================================================================
-/** @fn  caloSubHit
- *  Fast cast of GaussHitBase interface to concrete Gauss implementation
- *  @param  g4   pointer to GaussHitBase interface 
- *  @return cast (dynamic or static) to CaloSubHit
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline CaloSubHit* caloSubHit( GaussHitBase* g4 )
-{
-  GiGaUtil::FastCast<GaussHitBase,CaloSubHit> cast ;
-  return cast( g4 );  
+inline void* CaloSubHit::operator new(size_t) {
+  if (!aCaloSubHitAllocator) {
+    aCaloSubHitAllocator = new G4Allocator<CaloSubHit>;
+  }
+  return (void*)aCaloSubHitAllocator->MallocSingle();
 }
-// ============================================================================
 
-// ============================================================================
-// The END 
-// ============================================================================
-#endif // CALOSIM_CALOSUBHIT_H
-// ============================================================================
+inline void CaloSubHit::operator delete(void* aHit) {
+  aCaloSubHitAllocator->FreeSingle((CaloSubHit*)aHit);
+}
diff --git a/Sim/GaussCalo/src/EHCalSensDet.cpp b/Sim/GaussCalo/src/EHCalSensDet.cpp
deleted file mode 100755
index 4676cf923ea46ecab6eb0b98b7bc71f472da9bc0..0000000000000000000000000000000000000000
--- a/Sim/GaussCalo/src/EHCalSensDet.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// $Id: EHCalSensDet.cpp,v 1.6 2008-07-11 10:47:44 robbep Exp $ 
-// Include files 
-
-// SRD & STD 
-#include <algorithm>
-#include <vector>
-
-// CLHEP 
-#include "CLHEP/Geometry/Point3D.h"
-#include "CLHEP/Units/PhysicalConstants.h"
-
-// GaudiKernel
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/SmartDataPtr.h" 
-#include "GaudiKernel/IDataProviderSvc.h"
-
-// GaussTools 
-#include "GaussTools/GaussTrackInformation.h"
-
-// Geant4 
-#include "Geant4/G4Step.hh"
-#include "Geant4/G4TouchableHistory.hh"
-#include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
-#include "Geant4/G4EnergyLossTables.hh"
-
-// GiGaCnv 
-#include "GiGaCnv/GiGaVolumeUtils.h"
-
-// CaloDet
-#include "CaloDet/DeCalorimeter.h"
-
-// local
-#include "CaloHit.h"
-#include "CaloSimHash.h"
-#include "EHCalSensDet.h"
-
-//
-#include "AIDA/IHistogram1D.h"
-
-//-----------------------------------------------------------------------------
-//
-//  Implementation of class EHCalSensDet
-//
-//  2001-01-23 : Vanya Belyaev, Patrick Robbe
-//
-//-----------------------------------------------------------------------------
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-EHCalSensDet::EHCalSensDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector( name  )
-  , CaloSensDet        ( type , name , parent )
-  , m_slotWidth( 25 * CLHEP::ns )
-{
-  declareProperty( "SlotWidth" , m_slotWidth );
-}
-
-//=============================================================================
-// The fractions of energy deposited in consequitive time-slots
-// in the given Ecal/Hcal cell
-//=============================================================================
-StatusCode EHCalSensDet::timing 
-( const double             time      , 
-  const LHCb::CaloCellID&        cell      ,
-  CaloSubHit::Time&        slot    ,
-  CaloSensDet::Fractions&  fractions ) const 
-{
-  // clear input data 
-  slot = 0 ; fractions.clear();
-  
-  // evaluate the real delta time  
-  const double deltaT = time - t0 ( cell ) ;
-  
-  // find the absolute time slot 
-  slot  = (CaloSubHit::Time) floor( deltaT / slotWidth() ) ;
-  
-  // the time into the slot 
-  const double dt  = deltaT - slot * slotWidth() ;
-  
-  for ( Histos::const_iterator ihist = histos().begin() ; 
-        histos().end() != ihist ; ++ihist ) 
-    {
-      const AIDA::IHistogram1D* histo = *ihist ;
-      const int           bin   = histo -> coordToIndex ( dt / CLHEP::ns ) ;
-      const double        frac  = histo -> binHeight    ( bin     ) ;
-      fractions.push_back( frac ) ;
-    };
-  
-  if( fractions.empty() ) 
-    { Warning("timing()::no time information is available!"); }
-  
-  return StatusCode::SUCCESS ;
-}
diff --git a/Sim/GaussCalo/src/EHCalSensDet.h b/Sim/GaussCalo/src/EHCalSensDet.h
deleted file mode 100755
index db02d88ff5b3c960119bbb0e3a5a24f32b4f88fa..0000000000000000000000000000000000000000
--- a/Sim/GaussCalo/src/EHCalSensDet.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// $Id: EHCalSensDet.h,v 1.5 2007-03-18 21:33:19 gcorti Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.4  2007/01/12 15:24:46  ranjard
-// v9r0 - use GAUDI v19r0
-//
-// Revision 1.3  2006/01/17 15:52:57  odescham
-// v8r0 - Adapt to new Event Model & LHCb v20 migration
-//
-// Revision 1.2  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.1  2003/07/07 08:21:08  ibelyaev
-//  split the general CaloSensDet class
-//
-// ============================================================================
-#ifndef       GAUSSCALO_EHCalSensDet_H
-#define       GAUSSCALO_EHCalSensDet_H 1
-// ============================================================================
-// GaudiKernel
-/// Ntupel Svc
-#include "GaudiKernel/INTuple.h"
-#include "GaudiKernel/INTupleSvc.h"
-#include "GaudiKernel/NTuple.h"
-/// GiGa
-#include "GiGa/GiGaSensDetBase.h"
-/// local
-#include "CaloSim.h"
-#include "CaloHit.h"
-#include "CaloSubHit.h"
-#include "CaloSensDet.h"
-/// forward declarations
-class DeCalorimeter ;
-
-/** @class EHCalSensDet EHCalSensDet.h
- *
- *  The common base class fro Ecal/Hcal sensitive detectors.
- *  It includes the common timing treatment.
- *
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @author  Patrick Robbe robbe@lal.in2p3.fr
- *
- *  @date    23/01/2001
- */
-
-class EHCalSensDet: public CaloSensDet
-{
-public:
-
-  /** standard constructor
-   *  @see CaloSensDet
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
-   */
-  EHCalSensDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~EHCalSensDet() {};
-
-private:
-
-  // no default constructor
-  EHCalSensDet() ;
-  // no copy constructor
-  EHCalSensDet           ( const EHCalSensDet& );
-  // no assignement
-  EHCalSensDet& operator=( const EHCalSensDet& ) ;
-
-protected:
-
-  /** The fractions of energy deposited in consequitive time-bins
-   *  in the given Ecal/Hcal cell
-   *  @see CaloSensDet
-   *  @param time global time of energy deposition
-   *  @param cell cellID of the cell
-   *  @param slot (out) the first time bin
-   *  @param fracs (out) the vector of fractions for subsequent time-slots;
-   *  @return StatuscCode
-   */
-  StatusCode timing
-  ( const double            time      ,
-    const LHCb::CaloCellID&       cell      ,
-    CaloSubHit::Time&       slot      ,
-    CaloSensDet::Fractions& fractions ) const override;
-
-protected:
-
-  /// width of time-slot (25ns)
-  inline double slotWidth() const { return m_slotWidth ; }
-
-private:
-
-  /// width of time-slot (25ns)
-  double  m_slotWidth ;
-
-};
-// ============================================================================
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif  ///< GAUSSCALO_EHCalSensDet_H
-// ============================================================================
diff --git a/Sim/GaussCalo/src/EcalSensDet.cpp b/Sim/GaussCalo/src/EcalSensDet.cpp
index 269473cf28ba0896dd594f15ab3dce35ea95fdf0..926d8048af6e7710a39198d9412fbf4023f84f6b 100755
--- a/Sim/GaussCalo/src/EcalSensDet.cpp
+++ b/Sim/GaussCalo/src/EcalSensDet.cpp
@@ -1,6 +1,3 @@
-// $Id: EcalSensDet.cpp,v 1.12 2008-07-11 10:47:44 robbep Exp $
-// Include files
-
 // SRD & STD
 #include <algorithm>
 #include <vector>
@@ -10,29 +7,20 @@
 #include "CLHEP/Units/PhysicalConstants.h"
 
 // GaudiKernel
+#include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/SmartDataPtr.h"
-#include "GaudiKernel/IDataProviderSvc.h"
 
 // LHCb
 #include "LHCbMath/LHCbMath.h"
 
-// GaussTools
-#include "GaussTools/GaussTrackInformation.h"
-
 // Geant4
-#include "Geant4/G4Step.hh"
-#include "Geant4/G4TouchableHistory.hh"
-#include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
-#include "Geant4/G4EnergyLossTables.hh"
-
-// GiGaCnv
-#include "GiGaCnv/GiGaVolumeUtils.h"
-
-// CaloDet
-#include "CaloDet/DeCalorimeter.h"
+//#include "Geant4/G4EnergyLossTables.hh"
+//#include "Geant4/G4LogicalVolume.hh"
+//#include "Geant4/G4SDManager.hh"
+//#include "Geant4/G4Step.hh"
+//#include "Geant4/G4TouchableHistory.hh"
+//#include "Geant4/G4VPhysicalVolume.hh"
 
 // local
 #include "CaloHit.h"
@@ -54,58 +42,6 @@
  */
 // ============================================================================
 
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( EcalSensDet )
-
-// ============================================================================
-/** standard constructor
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see AlgTool
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-EcalSensDet::EcalSensDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector( name  )
-  , EHCalSensDet        ( type , name , parent )
-  //
-  //  , m_a_local_inner_ecal  ( 0.008 ) // local non uniformity amplitude
-  // inner ecal
-  //  , m_a_local_middle_ecal  ( 0.008 ) // local non uniformity amplitude
-  //  middle ecal
-  //  , m_a_local_outer_ecal   ( 0.03  ) // local non uniformity amplitude
-  // outer ecal
-  // For the moment put 0 for the local N.U.
-    , m_a_local_inner_ecal ( 0. )
-    , m_a_local_middle_ecal ( 0. )
-    , m_a_local_outer_ecal ( 0. )
-    , m_a_global_inner_ecal  ( 0.0004  ) // global non uniformity amplitude
-  //inner ecal
-    , m_a_global_middle_ecal ( 0.002  ) // global non uniformity amplitude
-  //  middle ecal
-    , m_a_global_outer_ecal  ( 0.03  ) // global non uniformity amplitude
-  // outer ecal
-    , m_a_reflection_height ( 0.09 ) // reflection on the edges - height
-    , m_a_reflection_width  ( 6. * CLHEP::mm ) // reflection on the edges - width
-{
-  ///
-  declareProperty ( "a_local_inner_ecal"   ,  m_a_local_inner_ecal ) ;
-  declareProperty ( "a_local_middle_ecal"  ,  m_a_local_middle_ecal ) ;
-  declareProperty ( "a_local_outer_ecal"   ,  m_a_local_outer_ecal ) ;
-  declareProperty ( "a_global_inner_ecal"   ,  m_a_global_inner_ecal ) ;
-  declareProperty ( "a_global_middle_ecal"  ,  m_a_global_middle_ecal ) ;
-  declareProperty ( "a_global_outer_ecal"   ,  m_a_global_outer_ecal ) ;
-  declareProperty ( "a_reflection_height"  , m_a_reflection_height ) ;
-  declareProperty ( "a_reflection_width"   , m_a_reflection_width  ) ;
-  //
-}
-
-
 // ============================================================================
 /** fill the hit with the concrete information about the energy and the time.
  *  The function is to be called from ProcessHits method.
@@ -125,60 +61,127 @@ EcalSensDet::EcalSensDet
  *
  */
 // ============================================================================
-StatusCode    EcalSensDet::fillHitInfo
-( CaloSubHit*                    hit           ,
-  const HepGeom::Point3D<double>& prePoint      ,
-  const double                   time ,
-  const double                   deposit       ,
-  const G4Track*                 track   ,
-  const G4ParticleDefinition*    particle   ,
-  const G4MaterialCutsCouple*    material   ,
-  const G4Step*                  step          ) const
-{
-
-  if( 0 == hit || 0 == step ) { return StatusCode::FAILURE ; }
+template <typename CELLGETTER>
+bool EcalSensDet<CELLGETTER>::fillHitInfo(
+    CaloSubHit* hit, const HepGeom::Point3D<double>& prePoint,
+    const double time, const double deposit, const G4Track* track,
+    const G4ParticleDefinition* particle, const G4MaterialCutsCouple* material,
+    const G4Step* step) const {
+  if (0 == hit || 0 == step) {
+    return false;
+  }
 
   // get the cell
-  const LHCb::CaloCellID& cellID = hit->cellID() ;
+  const LHCb::CaloCellID& cellID = hit->cellID();
 
   // Birk's Law Correction
-  double ecorrected = deposit *
-    birkCorrection( particle ,
-                    track->GetKineticEnergy() ,
-                    material ) ;
+  double ecorrected =
+      deposit *
+      this->birkCorrection(particle, track->GetKineticEnergy(), material);
 
-  //Local NonUniformity
+  // Local NonUniformity
   // if the cell is not valid do not apply the correction
   // (Anyway it will not be used)
-  //if ( calo() -> valid ( cellID ) ) {
-  ecorrected *= localNonUniformity( prePoint , cellID ) ;
+  // if ( calo() -> valid ( cellID ) ) {
+  ecorrected *= localNonUniformity(prePoint, cellID);
   //}
 
   // Timing
   // Uses method in EHCalSensDet
-  CaloSubHit::Time slot = 0   ;
-  Fractions fractions ;
-  StatusCode sc = timing( time , cellID , slot , fractions ) ;
+  CaloSubHit::Time slot = 0;
+  typename base_class::Fractions fractions;
+  bool sc = timing(time, cellID, slot, fractions);
 
-  if ( sc.isFailure() ) {
-    return Error( "Error in timing()" , sc ) ;
+  if (!sc) {
+    this->error("Error in timing()");
+    return false;
   }
 
-  if ( fractions.empty() ) {
-    Warning("The vector of fractions of energy is empty.") ;
+  if (fractions.empty()) {
+    this->warning("The vector of fractions of energy is empty.");
   }
 
-  for ( Fractions::const_iterator ifr = fractions.begin() ;
-        fractions.end() != ifr ; ++ifr ) {
-    const double fr = *ifr ;
-    if ( fr > 1.e-5 ) hit->add( slot , ecorrected * fr ) ;
-    slot++ ;
+  for (double fr : fractions) {
+    if (fr > 1.e-5) hit->add(slot, ecorrected * fr);
+    slot++;
   }
 
-  return StatusCode::SUCCESS ;
+  return true;
 }
 
+//=============================================================================
+// The fractions of energy deposited in consequitive time-slots
+// in the given Ecal/Hcal cell
+//=============================================================================
+template <typename CELLGETTER>
+bool EcalSensDet<CELLGETTER>::timing(
+    const double time, const LHCb::CaloCellID& cell, CaloSubHit::Time& slot,
+    typename base_class::Fractions& fractions) const {
+  // clear input data
+  slot = 0;
+  fractions.clear();
+
+  // evaluate the real delta time
+  const double deltaT = time - this->t0(cell);
+
+  // find the absolute time slot
+  slot = (CaloSubHit::Time)floor(deltaT / m_slotWidth);
+
+  // the time into the slot
+  const double dt = deltaT - slot * m_slotWidth;
+
+  for (auto histo : this->histos()) {
+    const int bin = histo->coordToIndex(dt / CLHEP::ns);
+    const double frac = histo->binHeight(bin);
+    fractions.push_back(frac);
+  };
+
+  if (fractions.empty()) {
+    this->warning("timing()::no time information is available!");
+  }
 
-// ============================================================================
-// The END
-// ============================================================================
+  return true;
+}
+
+#include "CaloSensDetFAC.h"
+
+template <typename CELLGETTER>
+class EcalSensDetFAC : public CaloSensDetFAC<EcalSensDet<CELLGETTER>> {
+  Gaudi::Property<double> m_a_local_inner_ecal{this, "a_local_inner_ecal", 0.};
+  Gaudi::Property<double> m_a_local_middle_ecal{this, "a_local_middle_ecal",
+                                                0.};
+  Gaudi::Property<double> m_a_local_outer_ecal{this, "a_local_outer_ecal", 0.};
+  Gaudi::Property<double> m_a_global_inner_ecal{this, "a_global_inner_ecal",
+                                                0.0004};
+  Gaudi::Property<double> m_a_global_middle_ecal{this, "a_global_middle_ecal",
+                                                 0.002};
+  Gaudi::Property<double> m_a_global_outer_ecal{this, "a_global_outer_ecal",
+                                                0.03};
+  Gaudi::Property<double> m_a_reflection_height{this, "a_reflection_height",
+                                                0.09};
+  Gaudi::Property<double> m_a_reflection_width{this, "a_reflection_width",
+                                               6. * CLHEP::mm};
+  Gaudi::Property<double> m_slotWidth{this, "SlotWidth", 25 * CLHEP::ns};
+
+  public:
+  using calotype = EcalSensDet<CELLGETTER>;
+  using base = CaloSensDetFAC<calotype>;
+  using typename base::CaloSensDetFAC;
+  virtual calotype* construct() const override {
+    auto tmp = base::construct();
+    tmp->m_a_local_inner_ecal = m_a_local_inner_ecal;
+    tmp->m_a_local_middle_ecal = m_a_local_middle_ecal;
+    tmp->m_a_local_outer_ecal = m_a_local_outer_ecal;
+    tmp->m_a_global_inner_ecal = m_a_global_inner_ecal;
+    tmp->m_a_global_middle_ecal = m_a_global_middle_ecal;
+    tmp->m_a_global_outer_ecal = m_a_global_outer_ecal;
+    tmp->m_a_reflection_height = m_a_reflection_height;
+    tmp->m_a_reflection_width = m_a_reflection_width;
+    tmp->m_slotWidth = m_slotWidth;
+    return tmp;
+  }
+};
+
+// Declaration of the Tool Factory
+typedef EcalSensDetFAC<CellFromLHCbGeo> EcalSensDetLHCbGeoFAC;
+DECLARE_COMPONENT_WITH_ID(EcalSensDetLHCbGeoFAC, "EcalSensDet")
diff --git a/Sim/GaussCalo/src/EcalSensDet.h b/Sim/GaussCalo/src/EcalSensDet.h
index 3045c98f3bd43f5ea8890dd533d6d4aa8f605a36..faf834ae8a1c0d5aec39541ebf6190b43844c9dc 100755
--- a/Sim/GaussCalo/src/EcalSensDet.h
+++ b/Sim/GaussCalo/src/EcalSensDet.h
@@ -1,23 +1,17 @@
-// $Id: EcalSensDet.h,v 1.11 2008-05-30 13:51:07 gcorti Exp $
-#ifndef       GAUSSCALO_EcalSensDet_H
-#define       GAUSSCALO_EcalSensDet_H 1
+#pragma once
 
 // Ntuple Svc
 #include "GaudiKernel/INTuple.h"
 #include "GaudiKernel/INTupleSvc.h"
 #include "GaudiKernel/NTuple.h"
+#include "LHCbMath/LHCbMath.h"
 
 // GiGa
-#include "GiGa/GiGaSensDetBase.h"
+#include "CaloSensDet.h"
 
 // local
-#include "CaloSim.h"
 #include "CaloHit.h"
-#include "EHCalSensDet.h"
-/// forward declarations
-//template <class SD> class GiGaSensDetFactory;
-
-class DeCalorimeter ;
+#include "CaloSim.h"
 
 /** @class EcalSensDet EcalSensDet.h
  *
@@ -28,13 +22,13 @@ class DeCalorimeter ;
  *  @date    23/01/2001
  */
 
-class EcalSensDet: public EHCalSensDet
-{
-  /// friend factory
-  //  friend class GiGaFactory<EcalSensDet>;
-
-protected:
+template <typename CELLGETTER>
+class EcalSensDet : public CaloSensDet<CELLGETTER> {
+  public:
+  using base_class = CaloSensDet<CELLGETTER>;
+  using base_class::CaloSensDet;
 
+  protected:
   /** fill the hit with the concrete information about the energy and the time.
    *  The function is to be called from ProcessHits method.
    *
@@ -53,73 +47,52 @@ protected:
    *                    etc for efficiency reasons.
    *
    */
-  StatusCode    fillHitInfo
-  ( CaloSubHit*                 hit         ,
-    const HepGeom::Point3D<double>& prePoint    ,
-    const double                globalTime  ,
-    const double                deposit     ,
-    const G4Track*              track       ,
-    const G4ParticleDefinition* pdef        ,
-    const G4MaterialCutsCouple* material    ,
-    const G4Step*               step        ) const override;
-
-public:
-
-  /** standard constructor
+  bool fillHitInfo(CaloSubHit* hit, const HepGeom::Point3D<double>& prePoint,
+                   const double globalTime, const double deposit,
+                   const G4Track* track, const G4ParticleDefinition* pdef,
+                   const G4MaterialCutsCouple* material,
+                   const G4Step* step) const override;
+
+  /** The fractions of energy deposited in consequitive time-bins
+   *  in the given Ecal/Hcal cell
    *  @see CaloSensDet
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
+   *  @param time global time of energy deposition
+   *  @param cell cellID of the cell
+   *  @param slot (out) the first time bin
+   *  @param fracs (out) the vector of fractions for subsequent time-slots;
+   *  @return StatuscCode
    */
-  EcalSensDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~EcalSensDet() {};
-
-private:
-
-  // no default constructor
-  EcalSensDet() ;
-  // no copy constructor
-  EcalSensDet           ( const EcalSensDet& );
-  // no assignement
-  EcalSensDet& operator=( const EcalSensDet& ) ;
-
-protected:
+  bool timing(
+      const double time, const LHCb::CaloCellID& cell, CaloSubHit::Time& slot,
+      typename CaloSensDet<CELLGETTER>::Fractions& fractions) const override;
 
+  protected:
   /** Correction due to the local non uniformity due to the light
    *  collection efficiency in cell cell
    */
-  inline double localNonUniformity
-  ( const HepGeom::Point3D<double>& prePoint    ,
-    const LHCb::CaloCellID& cell    ) const ;
+  inline double localNonUniformity(const HepGeom::Point3D<double>& prePoint,
+                                   const LHCb::CaloCellID& cell) const;
 
-private :
+  public:
   // Amplitudes of the local non uniformity correction
   // depending on the region of the Ecal
-  double                                      m_a_local_inner_ecal  ;
-  double                                      m_a_local_middle_ecal ;
-  double                                      m_a_local_outer_ecal  ;
+  double m_a_local_inner_ecal{0.};
+  double m_a_local_middle_ecal{0.};
+  double m_a_local_outer_ecal{0.};
   // Amplitudes of the global non uniformity correction
   // depending on the region of the Ecal
-  double                                      m_a_global_inner_ecal  ;
-  double                                      m_a_global_middle_ecal ;
-  double                                      m_a_global_outer_ecal  ;
+  double m_a_global_inner_ecal{0.0004};
+  double m_a_global_middle_ecal{0.002};
+  double m_a_global_outer_ecal{0.03};
   // Correction for light reflection at the edges
-  double                                      m_a_reflection_height ;
-  double                                      m_a_reflection_width  ;
+  double m_a_reflection_height{0.09};
+  double m_a_reflection_width{6. * CLHEP::mm};
+
+  /// width of time-slot (25ns)
+  double m_slotWidth{25 * CLHEP::ns};
 };
 // ============================================================================
 
-
-
-
 // ============================================================================
 // Local Non Uniformity
 // ============================================================================
@@ -127,77 +100,68 @@ private :
  *  collection efficiency in cell cell
  */
 
-inline double EcalSensDet::localNonUniformity
-( const HepGeom::Point3D<double>& prePoint ,
-  const LHCb::CaloCellID& cell ) const
-{
-
+template <typename CELLGETTER>
+inline double EcalSensDet<CELLGETTER>::localNonUniformity(
+    const HepGeom::Point3D<double>& prePoint,
+    const LHCb::CaloCellID& cell) const {
   // Only for ECal for the moment
-  double correction = 1. ;
+  double correction = 1.;
 
   // Find the position of the step
-  double x        = prePoint.x() ;
-  double y        = prePoint.y() ;
+  double x = prePoint.x();
+  double y = prePoint.y();
   // Center of the cell
-  double x0       = calo()->cellX( cell ) ;
-  double y0       = calo()->cellY( cell ) ;
+  double x0 = this->cellX(cell);
+  double y0 = this->cellY(cell);
 
   // Distance between fibers
   // and correction amplitude
-  double d        = 10.1 * CLHEP::mm ;
-  double A_local  = m_a_local_inner_ecal ; // in inner Ecal
-  double A_global = m_a_global_inner_ecal ;
+  double d = 10.1 * CLHEP::mm;
+  double A_local = m_a_local_inner_ecal;  // in inner Ecal
+  double A_global = m_a_global_inner_ecal;
 
   // Cell size
-  double cellSize = calo()->cellSize( cell ) ;
+  double cellSize = this->cellSize(cell);
 
   // Assign amplitude of non uniformity as a function of the
   // Ecal region
 
-  if ( cell.area() == 0 ) { // outer Ecal
-    A_local  = m_a_local_outer_ecal ;
-    A_global = m_a_global_outer_ecal ;
-    d        = 15.25 * CLHEP::mm ;
-  }
-  else if ( cell.area() == 1 ) { // middle Ecal
-    A_local  = m_a_local_middle_ecal ;
-    A_global = m_a_global_middle_ecal ;
+  if (cell.area() == 0) {  // outer Ecal
+    A_local = m_a_local_outer_ecal;
+    A_global = m_a_global_outer_ecal;
+    d = 15.25 * CLHEP::mm;
+  } else if (cell.area() == 1) {  // middle Ecal
+    A_local = m_a_local_middle_ecal;
+    A_global = m_a_global_middle_ecal;
   }
 
   // Local uniformity is product of x and y sine-like functions
   // The Amplitude of the sin-like function is a function of x and
   // y
-  if ( A_local > LHCb::Math::lowTolerance )
-    correction += A_local / 2. * ( 1. - cos( 2. * CLHEP::pi * (x-x0)/d ) ) *
-      ( 1. - cos( 2. * CLHEP::pi * (y-y0)/d ) ) ;
+  if (A_local > LHCb::Math::lowTolerance)
+    correction += A_local / 2. * (1. - cos(2. * CLHEP::pi * (x - x0) / d)) *
+                  (1. - cos(2. * CLHEP::pi * (y - y0) / d));
 
-  double rX(0.) , rY(0.) , hCell(0.) ;
+  double rX(0.), rY(0.), hCell(0.);
 
   // Global non uniformity
-  if ( A_global > LHCb::Math::lowTolerance ) {
-    rX = x - x0 ;
-    rY = y - y0 ;
-    hCell = cellSize / 2. ;
-    correction +=
-      A_global * ( hCell - rX ) * ( rX + hCell ) / ( hCell * hCell )
-      * ( hCell - rY ) * ( rY + hCell ) / ( hCell * hCell ) ;
+  if (A_global > LHCb::Math::lowTolerance) {
+    rX = x - x0;
+    rY = y - y0;
+    hCell = cellSize / 2.;
+    correction += A_global * (hCell - rX) * (rX + hCell) / (hCell * hCell) *
+                  (hCell - rY) * (rY + hCell) / (hCell * hCell);
   }
 
   // Light Reflexion on the edges
-  if ( m_a_reflection_height > LHCb::Math::lowTolerance ) {
-    rX = rX / m_a_reflection_width ;
-    rY = rY / m_a_reflection_width ;
-    hCell = hCell / m_a_reflection_width ;
+  if (m_a_reflection_height > LHCb::Math::lowTolerance) {
+    rX = rX / m_a_reflection_width;
+    rY = rY / m_a_reflection_width;
+    hCell = hCell / m_a_reflection_width;
     correction += m_a_reflection_height *
-      ( exp( - fabs ( rX + hCell ) ) + exp( - fabs ( rX - hCell ) )
-        + exp( - fabs ( rY + hCell ) ) + exp( - fabs ( rY - hCell ) ) ) ;
+                  (exp(-fabs(rX + hCell)) + exp(-fabs(rX - hCell)) +
+                   exp(-fabs(rY + hCell)) + exp(-fabs(rY - hCell)));
   }
 
-  return correction ;
+  return correction;
 }
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif  ///< GAUSSCALO_EcalSensDet_H
-// ============================================================================
diff --git a/Sim/GaussCalo/src/GaussSensPlaneDet.cpp b/Sim/GaussCalo/src/GaussSensPlaneDet.cpp
index 6950f1ea8c8e6dd721cdabef06fab38a2eb92987..3b6e14e0070d9659db03bd0d8355086f216362da 100755
--- a/Sim/GaussCalo/src/GaussSensPlaneDet.cpp
+++ b/Sim/GaussCalo/src/GaussSensPlaneDet.cpp
@@ -1,6 +1,3 @@
-// $Id: GaussSensPlaneDet.cpp,v 1.7 2008-07-11 10:47:44 robbep Exp $
-// Include files
-
 // SRD & STD
 #include <algorithm>
 #include <vector>
@@ -10,37 +7,32 @@
 #include "CLHEP/Units/PhysicalConstants.h"
 
 // GaudiKernel
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/SmartDataPtr.h"
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/IHistogramSvc.h"
+#include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/SmartDataPtr.h"
 
 // GaussTools
-#include "GaussTools/GaussTrackInformation.h"
+#include "GiGaMTCoreTruth/GaussinoTrackInformation.h"
 
 // Geant4
-#include "Geant4/G4Step.hh"
-#include "Geant4/G4TouchableHistory.hh"
-#include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4Electron.hh"
 #include "Geant4/G4EnergyLossTables.hh"
-#include "Geant4/G4Material.hh"
 #include "Geant4/G4Gamma.hh"
-#include "Geant4/G4Electron.hh"
-#include "Geant4/G4Positron.hh"
-#include "Geant4/G4MuonPlus.hh"
+#include "Geant4/G4LogicalVolume.hh"
+#include "Geant4/G4Material.hh"
 #include "Geant4/G4MuonMinus.hh"
-
-// GiGaCnv
-#include "GiGaCnv/GiGaVolumeUtils.h"
+#include "Geant4/G4MuonPlus.hh"
+#include "Geant4/G4Positron.hh"
+#include "Geant4/G4SDManager.hh"
+#include "Geant4/G4Step.hh"
+#include "Geant4/G4TouchableHistory.hh"
+#include "Geant4/G4VPhysicalVolume.hh"
 
 // CaloDet
 #include "CaloDet/DeCalorimeter.h"
 
 /// local
-#include "GaussSensPlaneHit.h"
 #include "GaussSensPlaneDet.h"
 
 using CLHEP::HepLorentzVector;
@@ -56,83 +48,13 @@ using CLHEP::HepLorentzVector;
 // ============================================================================
 
 // Declaration of the Tool Factory
-DECLARE_COMPONENT( GaussSensPlaneDet )
+// DECLARE_COMPONENT( GaussSensPlaneDet )
 
-
-// ============================================================================
-/** standard constructor
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see AlgTool
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-GaussSensPlaneDet::GaussSensPlaneDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector ( name  )
-  , GiGaSensDetBase      ( type , name , parent )
-  ///
-  , m_collectionName     ( "Hits"  )
-  , m_collection         ( 0 )
-  ///
-  , m_keepLinks ( false )
-    , m_oneEntry  ( true  )
-  ///
-  , m_cutForPhoton   ( 50 * CLHEP::MeV )
-  , m_cutForElectron ( 10 * CLHEP::MeV )
-  , m_cutForPositron ( 10 * CLHEP::MeV )
-  , m_cutForMuon     ( -1 * CLHEP::MeV )
-  , m_cutForCharged  ( 10 * CLHEP::MeV )
-  , m_cutForNeutral  ( 10 * CLHEP::MeV )
-  ///
-  , m_stat    (  true   )
-  , m_events  (  0      )
-  , m_hits    (  0      )
-  , m_hits2   (  0      )
-  , m_hitsMin (  1.e+10 )
-  , m_hitsMax ( -1.e+10 )
-{
-  declareProperty ( "CollectionName"       ,  m_collectionName    ) ;
-  //
-  declareProperty ( "KeepAllLinks"         , m_keepLinks      ) ;
-  declareProperty ( "OneEntry"             , m_oneEntry       ) ;
-  declareProperty ( "CutForPhoton"         , m_cutForPhoton   ) ;
-  declareProperty ( "CutForElectron"       , m_cutForElectron ) ;
-  declareProperty ( "CutForPositron"       , m_cutForPositron ) ;
-  declareProperty ( "CutForMuon"           , m_cutForMuon     ) ;
-  declareProperty ( "CutForCharged"        , m_cutForCharged  ) ;
-  declareProperty ( "CutForNeutral"        , m_cutForNeutral  ) ;
+GaussSensPlaneDet::GaussSensPlaneDet(const std::string& name)
+    : G4VSensitiveDetector(name) {
+  collectionName.insert("Hits");
 }
 
-
-// ============================================================================
-/** standard initialization (Gaudi)
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see   AlgTool
- *  @see  IAlgTool
- *  @return statsu code
- */
-// ============================================================================
-StatusCode GaussSensPlaneDet::initialize   ()
-{
-  // initialze the base class
-  StatusCode sc = GiGaSensDetBase::initialize();
-  if( sc.isFailure() )
-    { return Error("Could not initialize the base class!",sc);}
-  //
-  // clear collection name vector
-  collectionName.clear  () ;
-  collectionName.insert ( m_collectionName );
-  ///
-  return StatusCode::SUCCESS ;
-}
-
-
 // ============================================================================
 /** standard finalization (Gaudi)
  *  @see GiGaSensDetBase
@@ -142,23 +64,22 @@ StatusCode GaussSensPlaneDet::initialize   ()
  *  @return statsu code
  */
 // ============================================================================
-StatusCode GaussSensPlaneDet::finalize    ()
-{
-  if( m_stat )
-    { /// statistical printout
-      MsgStream log( msgSvc() , name() ) ;
-      log << MSG::DEBUG <<
-        format ( " <#Hits>/Min/Max=(%3d+-%3d)/%d/%4d "                  ,
-                 (long) m_hits                                          ,
-                 (long) sqrt ( fabs( m_hits2 - m_hits * m_hits ) )      ,
-                 (long) m_hitsMin                                       ,
-                 (long) m_hitsMax                                       )
-           << endmsg ;
-    }
-  // finalize the base class
-  return GiGaSensDetBase::finalize();
-}
-
+// StatusCode GaussSensPlaneDet::finalize    ()
+//{
+// if( m_stat )
+//{ /// statistical printout
+// MsgStream log( msgSvc() , name() ) ;
+// log << MSG::DEBUG <<
+// format ( " <#Hits>/Min/Max=(%3d+-%3d)/%d/%4d "                  ,
+//(long) m_hits                                          ,
+//(long) sqrt ( fabs( m_hits2 - m_hits * m_hits ) )      ,
+//(long) m_hitsMin                                       ,
+//(long) m_hitsMax                                       )
+//<< endmsg ;
+//}
+//// finalize the base class
+// return GiGaSensDetBase::finalize();
+//}
 
 // ============================================================================
 /** method from G4
@@ -167,24 +88,19 @@ StatusCode GaussSensPlaneDet::finalize    ()
  *  @param HCE pointer to hit collection of current event
  */
 // ============================================================================
-void GaussSensPlaneDet::Initialize( G4HCofThisEvent* HCE )
-{
-  //
-  m_collection =
-    new GaussSensPlaneHitsCollection ( SensitiveDetectorName ,
-                                       collectionName[0]     ) ;
-  //
-  const int id  = GetCollectionID( 0 ) ;
-
-  HCE -> AddHitsCollection( id , m_collection );
-
-  //
-  Print (" Initialize(): CollectionName='" + m_collection->GetName   () +
-         "' for SensDet='"                 + m_collection->GetSDname () +
-         "'" , StatusCode::SUCCESS , MSG::VERBOSE                       ).ignore() ;
-  //
-}
+void GaussSensPlaneDet::Initialize(G4HCofThisEvent* HCE) {
+  m_collection = new GaussSensPlaneHitsCollection(SensitiveDetectorName,
+                                                  collectionName[0]);
+  std::string hit_location = SensitiveDetectorName + "/" + collectionName[0];
 
+  debug("Registering location at " + hit_location);
+  int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(hit_location);
+
+  HCE->AddHitsCollection(HCID, m_collection);
+
+  verbose(" Initialize(): CollectionName='" + m_collection->GetName() +
+          "' for SensDet='" + m_collection->GetSDname() + "'");
+}
 
 // ============================================================================
 /** method from G4
@@ -193,105 +109,153 @@ void GaussSensPlaneDet::Initialize( G4HCofThisEvent* HCE )
  *  @param HCE pointer to hit collection of current event
  */
 // ============================================================================
-void GaussSensPlaneDet::EndOfEvent( G4HCofThisEvent* /* HCE */ )
-{
-  if( !m_stat ) { return ; }                               // RETURN
-    /// increase the counter of processed events
-  ++m_events ;
-  const double f1 = 1.0 / ( (double) ( m_events     ) ) ;
-  const double f2 =  f1 * ( (double) ( m_events - 1 ) ) ;
-
-  if ( 0 == m_collection )
-    { Warning ( " EndOfEvent(): HitCollection points to NULL " ) ; return ; }
-  typedef std::vector<GaussSensPlaneHit*> Hits ;
-  const Hits* hits = m_collection ->GetVector() ;
-  if ( 0 == hits )
-    { Error   (" EndOfEvent(): HitVector* points to NULL "     ) ; return ; }
-
-  const size_t nhits = hits->size() ;
-  m_hits    = m_hits  * f2 + nhits           * f1 ;
-  m_hits2   = m_hits2 * f2 + nhits  * nhits  * f1 ;
-
-  if ( nhits  > m_hitsMax   ) { m_hitsMax   = nhits  ; }
-  if ( nhits  < m_hitsMin   ) { m_hitsMin   = nhits  ; }
-
-  MsgStream log ( msgSvc() , name() ) ;
-  log << MSG::DEBUG <<
-    format ( " #GaussSensPlaneHits=%4d ", nhits ) << endmsg ;
+void GaussSensPlaneDet::EndOfEvent(G4HCofThisEvent* /* HCE */) {
+  if (!m_stat) {
+    return;
+  }  // RETURN
+  /// increase the counter of processed events
+  ++m_events;
+  const double f1 = 1.0 / ((double)(m_events));
+  const double f2 = f1 * ((double)(m_events - 1));
+
+  if (0 == m_collection) {
+    warning(" EndOfEvent(): HitCollection points to NULL ");
+    return;
+  }
+  typedef std::vector<GaussSensPlaneHit*> Hits;
+  const Hits* hits = m_collection->GetVector();
+  if (0 == hits) {
+    error(" EndOfEvent(): HitVector* points to NULL ");
+    return;
+  }
+
+  const size_t nhits = hits->size();
+  m_hits = m_hits * f2 + nhits * f1;
+  m_hits2 = m_hits2 * f2 + nhits * nhits * f1;
+
+  if (nhits > m_hitsMax) {
+    m_hitsMax = nhits;
+  }
+  if (nhits < m_hitsMin) {
+    m_hitsMin = nhits;
+  }
+
+  debug(format(" #GaussSensPlaneHits=%4d ", nhits));
 }
 
-
 // ============================================================================
 /** process the hit
  *  @param step     pointer to current Geant4 step
  *  @param history  pointert to touchable history
  */
 // ============================================================================
-bool GaussSensPlaneDet::ProcessHits( G4Step* step                      ,
-                                     G4TouchableHistory* /* history */ )
-{
-  if( 0 == step ) { return false ; }
+bool GaussSensPlaneDet::ProcessHits(G4Step* step,
+                                    G4TouchableHistory* /* history */) {
+  if (0 == step) {
+    return false;
+  }
   ///
-  const G4Track*              const track    = step     -> GetTrack      () ;
-  const int                         trackID  = track    -> GetTrackID    () ;
-  const G4ParticleDefinition* const particle = track    -> GetDefinition () ;
-  const double                      charge   = particle -> GetPDGCharge  () ;
+  const G4Track* const track = step->GetTrack();
+  const int trackID = track->GetTrackID();
+  const G4ParticleDefinition* const particle = track->GetDefinition();
+  const double charge = particle->GetPDGCharge();
 
-  const G4StepPoint* const          pre      = step    -> GetPreStepPoint  () ;
-  const G4StepPoint* const          post     = step    -> GetPostStepPoint () ;
+  const G4StepPoint* const pre = step->GetPreStepPoint();
+  const G4StepPoint* const post = step->GetPostStepPoint();
 
   // make hit only at first(last?) entry
-  if ( oneEntry() && pre -> GetPhysicalVolume() == post -> GetPhysicalVolume() )
-    { return false ; }                                               // RETURN
+  if (oneEntry() && pre->GetPhysicalVolume() == post->GetPhysicalVolume()) {
+    return false;
+  }  // RETURN
 
   // apply the cuts on energy
-  const double                       eKine     = pre   -> GetKineticEnergy  () ;
-
-  if      ( particle == G4Gamma::    Gamma     () && eKine < cutForPhoton   () )
-    { return false ; }                                               // RETURN
-  else if ( particle == G4Electron:: Electron  () && eKine < cutForElectron () )
-    { return false ; }                                               // RETURN
-  else if ( particle == G4Positron:: Positron  () && eKine < cutForPositron () )
-    { return false ; }                                               // RETURN
-  else if ( particle == G4MuonMinus::MuonMinus () && eKine < cutForMuon     () )
-    { return false ; }                                               // RETURN
-  else if ( particle == G4MuonPlus:: MuonPlus  () && eKine < cutForMuon     () )
-    { return false ; }                                               // RETURN
-  else if ( 0 != charge                           && eKine < cutForCharged  () )
-    { return false ; }                                               // RETURN
-  else if (                                          eKine < cutForNeutral  () )
-    { return false ; }                                               // RETURN
+  const double eKine = pre->GetKineticEnergy();
+
+  if (particle == G4Gamma::Gamma() && eKine < cutForPhoton()) {
+    return false;
+  }  // RETURN
+  else if (particle == G4Electron::Electron() && eKine < cutForElectron()) {
+    return false;
+  }  // RETURN
+  else if (particle == G4Positron::Positron() && eKine < cutForPositron()) {
+    return false;
+  }  // RETURN
+  else if (particle == G4MuonMinus::MuonMinus() && eKine < cutForMuon()) {
+    return false;
+  }  // RETURN
+  else if (particle == G4MuonPlus::MuonPlus() && eKine < cutForMuon()) {
+    return false;
+  }  // RETURN
+  else if (0 != charge && eKine < cutForCharged()) {
+    return false;
+  }  // RETURN
+  else if (eKine < cutForNeutral()) {
+    return false;
+  }  // RETURN
 
   // check the status of the track
-  GaussTrackInformation* info =
-    gaussTrackInformation( track->GetUserInformation() );
-  if( 0 == info )
-    { Error("Invalid Track information") ; return false ; }     // RETURN
+  auto info = GaussinoTrackInformation::Get();
+  if (!info) {
+    error("Invalid Track information");
+    return false;
+  }  // RETURN
 
   // ID of the track to be stored
   const int sTrackID =
-    keepLinks        () ? trackID :
-    info->toBeStored () ? trackID : track -> GetParentID () ;
+      keepLinks() ? trackID
+                  : info->storeTruth() ? trackID : track->GetParentID();
 
   // create new hit
-  GaussSensPlaneHit* hit =
-    new GaussSensPlaneHit
-    ( sTrackID                                           ,
-      LHCb::ParticleID       ( particle -> GetPDGEncoding () ) ,
-      HepLorentzVector ( pre      -> GetPosition    () ,
-                         pre      -> GetGlobalTime  () ) ,
-      HepLorentzVector ( pre      -> GetMomentum    () ,
-                         pre      -> GetTotalEnergy () ) ) ;
+  GaussSensPlaneHit* hit = new GaussSensPlaneHit(
+      sTrackID, LHCb::ParticleID(particle->GetPDGEncoding()),
+      HepLorentzVector(pre->GetPosition(), pre->GetGlobalTime()),
+      HepLorentzVector(pre->GetMomentum(), pre->GetTotalEnergy()));
 
   // add it into collection
-  m_collection -> insert ( hit    ) ;
+  m_collection->insert(hit);
 
   // update the track information
-  if( trackID == sTrackID ) { info->addToHits( hit ) ; }
+  if (trackID == sTrackID) {
+    info->addToHits(hit);
+  }
 
-  return true ;
+  return true;
 }
 
-// ============================================================================
-// The END
-// ============================================================================
+#include "GiGaMTFactories/GiGaMTG4SensDetFactory.h"
+
+typedef GiGaMTG4SensDetFactory<GaussSensPlaneDet> PlaneBaseFAC;
+class GaussSensPlaneDetFAC : public PlaneBaseFAC {
+  Gaudi::Property<bool> m_requireEDep{
+      this, "RequireEDep", true, "Hits must have non-zero Energy deposition"};
+
+  Gaudi::Property<bool> m_keepLinks{this, "KeepAllLinks", false};
+  Gaudi::Property<bool> m_oneEntry{this, "OneEntry", true};
+  Gaudi::Property<double> m_cutForPhoton{this, "CutForPhoton", 50 * CLHEP::MeV};
+  Gaudi::Property<double> m_cutForElectron{this, "CutForElectron",
+                                           10 * CLHEP::MeV};
+  Gaudi::Property<double> m_cutForPositron{this, "CutForPositron",
+                                           10 * CLHEP::MeV};
+  Gaudi::Property<double> m_cutForMuon{this, "CutForMuon", -1 * CLHEP::MeV};
+  Gaudi::Property<double> m_cutForCharged{this, "CutForCharged",
+                                          10 * CLHEP::MeV};
+  Gaudi::Property<double> m_cutForNeutral{this, "CutForNeutral",
+                                          10 * CLHEP::MeV};
+
+  public:
+  using PlaneBaseFAC::PlaneBaseFAC;
+  GaussSensPlaneDet* construct() const override {
+    auto tmp = PlaneBaseFAC::construct();
+    tmp->m_keepLinks = m_keepLinks;
+    tmp->m_oneEntry = m_oneEntry;
+    tmp->m_cutForPhoton = m_cutForPhoton;
+    tmp->m_cutForElectron = m_cutForElectron;
+    tmp->m_cutForPositron = m_cutForPositron;
+    tmp->m_cutForMuon = m_cutForMuon;
+    tmp->m_cutForCharged = m_cutForCharged;
+    tmp->m_cutForNeutral = m_cutForNeutral;
+    return tmp;
+  }
+};
+
+DECLARE_COMPONENT_WITH_ID(GaussSensPlaneDetFAC, "GaussSensPlaneDet")
diff --git a/Sim/GaussCalo/src/GaussSensPlaneDet.h b/Sim/GaussCalo/src/GaussSensPlaneDet.h
index 8b28722b078486cf31bcbd77a094c239ba7ab447..9c838bc59ceda7e0c012f667ffc66f324b5e6135 100755
--- a/Sim/GaussCalo/src/GaussSensPlaneDet.h
+++ b/Sim/GaussCalo/src/GaussSensPlaneDet.h
@@ -1,6 +1,4 @@
-// $Id: GaussSensPlaneDet.h,v 1.4 2007-03-18 21:33:19 gcorti Exp $
-#ifndef       GAUSS_GaussSensPlaneDet_H
-#define       GAUSS_GaussSensPlaneDet_H 1
+#pragma once
 
 // GaudiKernel
 // Ntuple Svc
@@ -8,12 +6,11 @@
 #include "GaudiKernel/INTupleSvc.h"
 #include "GaudiKernel/NTuple.h"
 
-// GiGa
-#include "GiGa/GiGaSensDetBase.h"
-
+#include "Geant4/G4VSensitiveDetector.hh"
 // local
 #include "CaloHit.h"
-
+#include "GaussSensPlaneHit.h"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
 
 /** @class GaussSensPlaneDet GaussSensPlaneDet.h GaussSensPlaneDet.h
  *
@@ -21,33 +18,12 @@
  *  @date    23/01/2001
  */
 
-class GaussSensPlaneDet: public GiGaSensDetBase
-{
+class GaussSensPlaneDet : public G4VSensitiveDetector,
+                          public virtual GiGaMessage {
   /// friend factory
   //  friend class GiGaFactory<GaussSensPlaneDet>;
 
-public :
-
-  /** standard initialization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode initialize   () override;
-
-  /** standard finalization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode finalize    () override;
-
-public:
-
+  public:
   /** process the hit.
    *  The method is invoked by G4 for each step in the
    *  sensitive detector. This implementation performs the
@@ -66,106 +42,79 @@ public:
    *  @param history  pointert to touchable history
    *  @attention One should not redefine this method for specific sub-detectors.
    */
-  bool ProcessHits
-  ( G4Step*             step    ,
-    G4TouchableHistory* history ) override;
+  bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
 
   /** method from G4
    *  (Called at the begin of each event)
    *  @see G4VSensitiveDetector
    *  @param HCE pointer to hit collection of current event
    */
-  void Initialize( G4HCofThisEvent* HCE ) override;
+  void Initialize(G4HCofThisEvent* HCE) override;
 
   /** method from G4
    *  (Called at the end of each event)
    *  @see G4VSensitiveDetector
    *  @param HCE pointer to hit collection of current event
    */
-  void EndOfEvent( G4HCofThisEvent* HCE ) override;
-
+  void EndOfEvent(G4HCofThisEvent* HCE) override;
 
-  /** standard constructor
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
-   */
-  GaussSensPlaneDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
+  GaussSensPlaneDet(const std::string& name);
 
   /// destructor (virtual and protected)
-  virtual ~GaussSensPlaneDet() {};
-
-protected:
+  virtual ~GaussSensPlaneDet(){};
 
+  protected:
   /// keep all original links to G4Tracks/MCParticles
-  inline bool   keepLinks       () const { return m_keepLinks       ; }
+  inline bool keepLinks() const { return m_keepLinks; }
   /// only one entry ?
-  inline bool   oneEntry        () const { return m_oneEntry        ; }
+  inline bool oneEntry() const { return m_oneEntry; }
 
   /// cut for photons to create hit
-  inline double cutForPhoton    () const { return m_cutForPhoton    ; }
+  inline double cutForPhoton() const { return m_cutForPhoton; }
 
   /// cut for e-   to create hit
-  inline double cutForElectron  () const { return m_cutForElectron  ; }
+  inline double cutForElectron() const { return m_cutForElectron; }
 
   /// cut for e+   to create hit
-  inline double cutForPositron  () const { return m_cutForPositron  ; }
+  inline double cutForPositron() const { return m_cutForPositron; }
 
   /// cut for muon to create hit
-  inline double cutForMuon      () const { return m_cutForMuon      ; }
+  inline double cutForMuon() const { return m_cutForMuon; }
 
   /// cut for other charged particle to create hit
-  inline double cutForCharged   () const { return m_cutForCharged   ; }
+  inline double cutForCharged() const { return m_cutForCharged; }
 
   /// cut for othe rneutral particle to create hit
-  inline double cutForNeutral   () const { return m_cutForNeutral   ; }
-
-private:
+  inline double cutForNeutral() const { return m_cutForNeutral; }
 
+  private:
   // no default constructor
-  GaussSensPlaneDet() ;
+  GaussSensPlaneDet();
   // no copy constructor
-  GaussSensPlaneDet           ( const GaussSensPlaneDet& );
+  GaussSensPlaneDet(const GaussSensPlaneDet&);
   // no assignement
-  GaussSensPlaneDet& operator=( const GaussSensPlaneDet& ) ;
-
-protected:
+  GaussSensPlaneDet& operator=(const GaussSensPlaneDet&);
 
-  std::string                   m_collectionName ;
-  GaussSensPlaneHitsCollection* m_collection     ;
+  protected:
+  GaussSensPlaneHitsCollection* m_collection{nullptr};
 
-  bool   m_keepLinks       ;
-  bool   m_oneEntry        ;
+  public:
+  bool m_keepLinks{false};
+  bool m_oneEntry{true};
 
-  double m_cutForPhoton    ;
-  double m_cutForElectron  ;
-  double m_cutForPositron  ;
-  double m_cutForMuon      ;
-  double m_cutForCharged   ;
-  double m_cutForNeutral   ;
-
-private:
+  double m_cutForPhoton{50 * CLHEP::MeV};
+  double m_cutForElectron{10 * CLHEP::MeV};
+  double m_cutForPositron{10 * CLHEP::MeV};
+  double m_cutForMuon{-1 * CLHEP::MeV};
+  double m_cutForCharged{10 * CLHEP::MeV};
+  double m_cutForNeutral{10 * CLHEP::MeV};
 
+  private:
   // final statistics
-  bool   m_stat    ;
-  long   m_events  ;
-  double m_hits    ;
-  double m_hits2   ;
-  double m_hitsMin ;
-  double m_hitsMax ;
-
+  bool m_stat{true};
+  long m_events{0};
+  double m_hits{0};
+  double m_hits2{0};
+  double m_hitsMin{1.e+10};
+  double m_hitsMax{-1.e+10};
 };
-// ============================================================================
-
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif  ///< GAUSSCALO_GaussSensPlaneDet_H
-// ============================================================================
diff --git a/Sim/GaussCalo/src/GaussSensPlaneHit.cpp b/Sim/GaussCalo/src/GaussSensPlaneHit.cpp
index 246eb7b40f025975214d45a087817c08b132b257..9132b349acf6b11d1741b396bd9ba46d2fac5019 100755
--- a/Sim/GaussCalo/src/GaussSensPlaneHit.cpp
+++ b/Sim/GaussCalo/src/GaussSensPlaneHit.cpp
@@ -1,22 +1,3 @@
-// $Id: GaussSensPlaneHit.cpp,v 1.4 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.3  2004/12/14 14:53:18  gcorti
-// fix for compilation
-//
-// Revision 1.2  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.1  2003/07/07 16:09:39  ibelyaev
-//  add Calorimeter Sensitive Palne hits and the converter
-//
-// ============================================================================
-// Include files
-// ============================================================================
-// from GiGa
-#include "GiGa/GiGaUtil.h"
 // Geant4
 #include "Geant4/G4Allocator.hh"
 // local
@@ -35,27 +16,7 @@ using CLHEP::HepLorentzVector;
  */
 // ============================================================================
 
-namespace GaussSensPlaneHitLocal
-{
-  // ==========================================================================
-  /** @var  s_Allocator
-   *  allocator to make more efficient creation delete
-   *  of GaussSensPlaneHits objects
-   */
-  // ==========================================================================
-  G4Allocator<GaussSensPlaneHit>            s_Allocator ;
-  // ==========================================================================
-
-  // ==========================================================================
-  /** @var s_Counter
-   *  statsic instace counter for all functions
-   */
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  static GiGaUtil::InstanceCounter<GaussSensPlaneHit> s_Counter   ;
-#endif
-  // ==========================================================================
-}
+G4ThreadLocal G4Allocator<GaussSensPlaneHit>* aGaussSensPlaneHitAllocator{nullptr};
 
 
 // ============================================================================
@@ -70,29 +31,12 @@ GaussSensPlaneHit::GaussSensPlaneHit
   const LHCb::ParticleID&       pid      ,
   const HepLorentzVector& position ,
   const HepLorentzVector& momentum )
-  : GaussHitBase ()
+  : Gaussino::HitBase()
   , m_pid        ( pid      )
   , m_position   ( position )
   , m_momentum   ( momentum )
 {
   setTrackID ( track ) ;
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  GaussSensPlaneHitLocal::s_Counter.increment () ;
-#endif
-  // ==========================================================================
-}
-
-// ============================================================================
-/// destructor
-// ============================================================================
-GaussSensPlaneHit::~GaussSensPlaneHit()
-{
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  GaussSensPlaneHitLocal::s_Counter.decrement () ;
-#endif
-  // ==========================================================================
 }
 
 // ============================================================================
@@ -102,7 +46,7 @@ GaussSensPlaneHit::~GaussSensPlaneHit()
 // ============================================================================
 GaussSensPlaneHit::GaussSensPlaneHit
 ( const GaussSensPlaneHit& hit )
-  : GaussHitBase ( hit             )
+  : Gaussino::HitBase( hit             )
   , m_pid        ( hit.pid      () )
   , m_position   ( hit.position () )
   , m_momentum   ( hit.momentum () )
@@ -113,27 +57,3 @@ GaussSensPlaneHit::GaussSensPlaneHit
 #endif
   // ==========================================================================
 }
-
-
-// ============================================================================
-/// overloaded 'new' oerator
-// ============================================================================
-void* GaussSensPlaneHit::operator new(size_t)
-{
-  void *hit  ;
-  hit = (void *) GaussSensPlaneHitLocal::s_Allocator.MallocSingle () ;
-  return hit ;
-}
-
-
-// ============================================================================
-/// overloaded 'delete' oerator
-// ============================================================================
-void GaussSensPlaneHit::operator delete( void *hit )
-{ GaussSensPlaneHitLocal::s_Allocator.FreeSingle( (GaussSensPlaneHit*) hit ); }
-
-
-// ============================================================================
-// The END
-// ============================================================================
-
diff --git a/Sim/GaussCalo/src/GaussSensPlaneHit.h b/Sim/GaussCalo/src/GaussSensPlaneHit.h
index 19daaf1f85758c647c4850bf47b5594ab39e001a..2a3f7ff045bcb313af474f697926c73afbc2487e 100755
--- a/Sim/GaussCalo/src/GaussSensPlaneHit.h
+++ b/Sim/GaussCalo/src/GaussSensPlaneHit.h
@@ -1,17 +1,4 @@
-// $Id: GaussSensPlaneHit.h,v 1.3 2006-01-17 15:52:57 odescham Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.2  2004/01/14 13:38:10  ranjard
-// v6r0 - fix to be used with Gaudi v14r0
-//
-// Revision 1.1  2003/07/07 16:09:39  ibelyaev
-//  add Calorimeter Sensitive Palne hits and the converter
-//
-// ============================================================================
-#ifndef GAUSSTOOLS_GAUSSSENSITIVEPLANEHIT_H
-#define GAUSSTOOLS_GAUSSSENSITIVEPLANEHIT_H 1
+#pragma once
 // ============================================================================
 // Include files
 // ============================================================================
@@ -20,7 +7,7 @@
 // Event
 #include "Kernel/ParticleID.h"
 // GaussTools
-#include "GaussTools/GaussHitBase.h"
+#include "GiGaMTCoreDet/GaussHitBase.h"
 // Geant4
 #include "Geant4/G4THitsCollection.hh"
 // ============================================================================
@@ -32,7 +19,7 @@
  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
  *  @date   2003-07-07
  */
-class GaussSensPlaneHit : public GaussHitBase
+class GaussSensPlaneHit : public Gaussino::HitBase
 {
 public :
   /// the actual type of TrackID
@@ -63,9 +50,6 @@ public:
   GaussSensPlaneHit
   ( const GaussSensPlaneHit& hit ) ;
 
-  /// destructor
-  virtual ~GaussSensPlaneHit() ;
-
   /// access to actual particle ID
   inline const LHCb::ParticleID&       pid         () const { return m_pid      ; }
   // set new value for particle ID
@@ -104,59 +88,15 @@ private:
 typedef G4THitsCollection<GaussSensPlaneHit>
 GaussSensPlaneHitsCollection ;
 
-// ============================================================================
-/** @fn  gaussSensPlaneHit
- *  Fast cast of G4VHit interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHit interface
- *  @return cast (dynamic or static) to GaussSensitivelaneHit
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline GaussSensPlaneHit*
-gaussSensPlaneHitHit ( G4VHit* g4 )
-{
-  GiGaUtil::FastCast<G4VHit,GaussSensPlaneHit> cast ;
-  return cast( g4 );
-}
-
+extern G4ThreadLocal G4Allocator<GaussSensPlaneHit>* aGaussSensPlaneHitAllocator;
 
-// ============================================================================
-/** @fn  gaussSensPlaneHit
- *  Fast cast of GaussHitBaseto concrete Gauss implementation
- *  @param  g4   pointer to GaussHitBase interface
- *  @return cast (dynamic or static) to GaussSensPlaneHit
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline GaussSensPlaneHit*
-gaussSensPlaneHitHit ( GaussHitBase* g4 )
-{
-  GiGaUtil::FastCast<GaussHitBase,GaussSensPlaneHit> cast ;
-  return cast( g4 );
+inline void* GaussSensPlaneHit::operator new(size_t) {
+  if (!aGaussSensPlaneHitAllocator) {
+    aGaussSensPlaneHitAllocator = new G4Allocator<GaussSensPlaneHit>;
+  }
+  return (void*)aGaussSensPlaneHitAllocator->MallocSingle();
 }
 
-
-// ============================================================================
-/** @fn  caloHits
- *  Fast cast of G4VHitsCollection interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHitsCollection interface
- *  @return cast (dynamic or static) to CaloHitsColelction*
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline GaussSensPlaneHitsCollection*
-gaussSensPlaneHits ( G4VHitsCollection* g4 )
-{
-  GiGaUtil::FastCast<G4VHitsCollection,GaussSensPlaneHitsCollection> cast ;
-  return cast( g4 );
+inline void GaussSensPlaneHit::operator delete(void* aHit) {
+  aGaussSensPlaneHitAllocator->FreeSingle((GaussSensPlaneHit*)aHit);
 }
-
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif // GAUSSTOOLS_GAUSSSENSITIVEPLANEHIT_H
-// ============================================================================
diff --git a/Sim/GaussCalo/src/GetCaloHitsAlg.cpp b/Sim/GaussCalo/src/GetCaloHitsAlg.cpp
index 5c5d9cd176e404cc8e0041b46f806c59361c89c3..b0960d8fc05747b5d822dbd57906afa2e1f1abd7 100755
--- a/Sim/GaussCalo/src/GetCaloHitsAlg.cpp
+++ b/Sim/GaussCalo/src/GetCaloHitsAlg.cpp
@@ -1,24 +1,16 @@
 // $Id: GetCaloHitsAlg.cpp,v 1.6 2009-03-26 21:38:44 robbep Exp $
-// Include files 
+// Include files
 
 // from Gaudi
 
-// from GiGa 
-#include "GiGa/IGiGaSvc.h"
-#include "GiGa/GiGaHitsByName.h"
-
-// from GiGaCnv
-#include "GiGaCnv/IGiGaKineCnvSvc.h" 
-#include "GiGaCnv/IGiGaCnvSvcLocation.h"
-#include "GiGaCnv/GiGaKineRefTable.h"
-
-// Event 
+// Event
 #include "Event/MCCaloHit.h"
 
 // local
 #include "CaloHit.h"
 #include "CaloSubHit.h"
 #include "GetCaloHitsAlg.h"
+#include "GiGaMTCoreTruth/MCTruthConverter.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : GetCaloHitsAlg
@@ -27,140 +19,91 @@
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_COMPONENT( GetCaloHitsAlg )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-GetCaloHitsAlg::GetCaloHitsAlg( const std::string& name,
-                                ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator ) ,
-    m_gigaSvc( 0 ) , 
-    m_gigaKineCnvSvc( 0 ) {
-    declareProperty( "GiGaService" , m_gigaSvcName = "GiGa" ) ;
-    declareProperty( "KineCnvService" , 
-                     m_kineSvcName = IGiGaCnvSvcLocation::Kine ) ;
-    declareProperty( "MCHitsLocation" , m_hitsLocation = "" ) ;
-    declareProperty( "CollectionName" , m_colName = "" ) ;
-    declareProperty( "MCParticles"    , 
-                     m_mcParticles = LHCb::MCParticleLocation::Default ) ;
-  }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-GetCaloHitsAlg::~GetCaloHitsAlg() {}
-
-//=============================================================================
-// Initialisation. Check parameters
-//=============================================================================
-StatusCode GetCaloHitsAlg::initialize() {
-  // Initialize base class
-  StatusCode sc = GaudiAlgorithm::initialize() ;
-  if ( sc.isFailure() ) return sc ;
-
-  debug() << "==> Initialise" << endmsg ;
-
-  // Get GiGa Service 
-  m_gigaSvc = svc< IGiGaSvc >( m_gigaSvcName ) ;
-
-  // Check GiGa service exists
-  if ( 0 == m_gigaSvc ) 
-    return Error( "execute() : IGiGaSvc* points to NULL" ) ;
-  
-  // get kineCnv service holding MCParticle/Geant4 table
-  m_gigaKineCnvSvc = svc< IGiGaKineCnvSvc >( m_kineSvcName ) ;
-  
-  return StatusCode::SUCCESS;
-}
+DECLARE_COMPONENT(GetCaloHitsAlg)
 
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode GetCaloHitsAlg::execute() {
-  debug() << "==> Execute" << endmsg ;
-
-  // Register output container to contain MCCaloHits
-  LHCb::MCCaloHits * hits = new LHCb::MCCaloHits( ) ;
-  put( hits , m_hitsLocation ) ;
-  
-  // Get the G4 hit collections corresponding to Calo
-  GiGaHitsByName col( m_colName ) ;
-  *m_gigaSvc >> col ;
-  if ( 0 == col.hits( ) ) 
-    return Warning( "The hit collection='" + m_colName + "' is not found ! " ,
-                    StatusCode::SUCCESS ) ;
-  
-  // Now cast to Calo hits collections
-  const CaloHitsCollection * hitCollection = caloHits( col.hits( ) ) ;
-  if ( 0 == hitCollection ) return Error( "Wrong collection type" ) ;
-  
-  // Get the reference table between G4 tracks and MC particles
-  if ( ! exist< LHCb::MCParticles >( m_mcParticles ) ) 
-    return Error( "LHCb::MCParticles do not exist at'" +
-                  m_mcParticles + "'" ) ;
-  const GiGaKineRefTable & table = m_gigaKineCnvSvc -> table() ;
-
-  const size_t numOfHits = hitCollection -> entries() ;
-  if ( numOfHits > 0 ) {
-    hits->reserve( numOfHits );
-  }
-  
-  // transform G4Hit in MCHits:
-  // Loop over all hits in collection
-  for ( size_t iHit = 0 ; iHit < numOfHits ; ++iHit ) {
-    // The calo hit in the calorimeter
-    const CaloHit * hit = (*hitCollection)[ iHit ] ;
-    if ( 0 == hit ) continue ;
-
-    // Loop over all sub hits of this calo hit
-    for ( CaloHit::iterator iter = hit -> begin() ; iter != hit -> end( ) ;
-          ++iter ) {
-      // The sub hit
-      const CaloSubHit * subhit = iter -> second ;
-      if ( 0 == subhit ) continue ;
-      
-      // Pointer to the corresponding LHCb::MCParticle using trackID of the subhit
-      const LHCb::MCParticle * mcp = table( subhit -> trackID() ).particle( ) ;
-      if ( 0 == mcp ) 
-        warning() << "No pointer to LHCb::MCParticle for MCHit associated to G4 "
-                  << "trackID: " << subhit -> trackID() << endmsg ;
-      
-      // Loop over all energy/time deposits strored in the subhit
-      for ( CaloSubHit::iterator entry = subhit -> begin() ; 
-            entry != subhit -> end() ; ++entry ) {
-        // Create the new MCHit
-        LHCb::MCCaloHit * mchit = new LHCb::MCCaloHit() ;
-        // Fill it with:
-        //   - Calorimeter CellID of the hit
-        mchit -> setCellID( hit -> cellID() ) ;
-        //   - Time when the energy is deposited
-        mchit -> setTime( entry -> first ) ;
-        //   - Active energy deposited
-        mchit -> setActiveE( entry -> second ) ;
-        //   - Pointer to the LHCb::MCParticle giving the hit
-        mchit -> setParticle( mcp ) ;
-
-        // Now insert in output container
-        hits -> add( mchit ) ;
-      }
-    } 
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode GetCaloHitsAlg::finalize() {
-  debug() << "==> Finalize" << endmsg ;
-
-  release( m_gigaSvc ) ;
-  release( m_gigaKineCnvSvc ) ;
-
-  return GaudiAlgorithm::finalize( ) ;
+LHCb::MCCaloHits GetCaloHitsAlg::operator()(
+    const G4EventProxies& eventproxies,
+    const LinkedParticleMCParticleLinks& mcplinks) const {
+    debug() << "==> Execute" << endmsg;
+
+    // Register output container to contain MCCaloHits
+    LHCb::MCCaloHits hits{};
+    size_t total_numHits{0};
+
+    for (auto& ep : eventproxies) {
+        auto hitCollection = ep.GetHitCollection<CaloHitsCollection>(m_colName);
+        if (hitCollection) {
+            total_numHits += hitCollection->entries();
+        }
+    }
+    if (total_numHits > 0) {
+        hits.reserve(total_numHits);
+    }
+
+    for (auto& ep : eventproxies) {
+        auto hitCollection = ep.GetHitCollection<CaloHitsCollection>(m_colName);
+        if (!hitCollection) {
+            warning() << "The hit collection='" + m_colName + "' is not found!"
+                      << endmsg;
+            continue;
+        }
+        // reserve elements on output container
+        size_t numOfHits = hitCollection->entries();
+        // transform G4Hit in MCHits:
+        // Loop over all hits in collection
+        for (size_t iHit = 0; iHit < numOfHits; ++iHit) {
+            // The calo hit in the calorimeter
+            const CaloHit* hit = (*hitCollection)[iHit];
+            if (0 == hit) continue;
+
+            // Loop over all sub hits of this calo hit
+            for (CaloHit::iterator iter = hit->begin(); iter != hit->end();
+                 ++iter) {
+                // The sub hit
+                const CaloSubHit* subhit = iter->second;
+                if (0 == subhit) continue;
+
+                // Loop over all energy/time deposits strored in the subhit
+                for (CaloSubHit::iterator entry = subhit->begin();
+                     entry != subhit->end(); ++entry) {
+                    // Create the new MCHit
+                    LHCb::MCCaloHit* mchit = new LHCb::MCCaloHit();
+                    // Fill it with:
+                    //   - Calorimeter CellID of the hit
+                    mchit->setCellID(hit->cellID());
+                    //   - Time when the energy is deposited
+                    mchit->setTime(entry->first);
+                    //   - Active energy deposited
+                    mchit->setActiveE(entry->second);
+                    //   - Pointer to the LHCb::MCParticle giving the hit
+                    int trackID = subhit->GetTrackID();
+                    if (auto lp = ep.truth()->GetParticleFromTrackID(trackID);
+                        lp) {
+                        if (auto it = mcplinks.find(lp);
+                            it != std::end(mcplinks)) {
+                            mchit->setParticle(it->second);
+                        } else {
+                            warning() << "No pointer to MCParticle for MCHit "
+                                         "associated to G4 "
+                                         "trackID: "
+                                      << trackID << endmsg;
+                        }
+                    } else {
+                        warning() << "No LinkedParticle found. Something went "
+                                     "seriously wrong. "
+                                     "trackID: "
+                                  << trackID << endmsg;
+                    }
+
+                    // Now insert in output container
+                    hits.add(mchit);
+                }
+            }
+        }
+    }
+
+    return hits;
 }
-
-//=============================================================================
diff --git a/Sim/GaussCalo/src/GetCaloHitsAlg.h b/Sim/GaussCalo/src/GetCaloHitsAlg.h
index 9a327dd97213ef3b841361db291f11782970cc2e..f12e4a00a142b3b95c381aea518209f9bb1597f5 100755
--- a/Sim/GaussCalo/src/GetCaloHitsAlg.h
+++ b/Sim/GaussCalo/src/GetCaloHitsAlg.h
@@ -1,14 +1,11 @@
-// $Id: GetCaloHitsAlg.h,v 1.2 2009-03-26 21:38:44 robbep Exp $
-#ifndef GAUSSCALO_GETCALOHITSALG_H
-#define GAUSSCALO_GETCALOHITSALG_H 1
+#pragma once
 
-// Include files
-// from Gaudi
+#include "Defaults/Locations.h"
+#include "Event/MCCaloHit.h"
 #include "GaudiAlg/GaudiAlgorithm.h"
-
-// forward declarations
-class IGiGaSvc ;
-class IGiGaKineCnvSvc ;
+#include "GaudiAlg/Transformer.h"
+#include "GiGaMTCoreRun/G4EventProxy.h"
+#include "MCTruthToEDM/LinkedParticleMCParticleLink.h"
 
 /** @class GetCaloHitsAlg GetCaloHitsAlg.h
  *  Conversion from G4 hits to MC CaloHits
@@ -16,34 +13,27 @@ class IGiGaKineCnvSvc ;
  *  @author Patrick Robbe
  *  @date   2005-11-14
  */
-class GetCaloHitsAlg : public GaudiAlgorithm {
+class GetCaloHitsAlg
+    : public Gaudi::Functional::Transformer<LHCb::MCCaloHits(
+          const G4EventProxies&, const LinkedParticleMCParticleLinks&)> {
 public:
-  /// Standard constructor
-  GetCaloHitsAlg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~GetCaloHitsAlg( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
+    /// Standard constructor
+    GetCaloHitsAlg(const std::string& name, ISvcLocator* pSvcLocator)
+        : Transformer(
+              name, pSvcLocator,
+              {{KeyValue{"Input", Gaussino::G4EventsLocation::Default},
+                KeyValue{
+                    "LinkedParticleMCParticleLinks",
+                    Gaussino::LinkedParticleMCParticleLinksLocation::Default}}},
+              KeyValue{"MCHitsLocation", ""}) {}
+
+    virtual ~GetCaloHitsAlg() = default;
+
+    virtual LHCb::MCCaloHits operator()(
+        const G4EventProxies&,
+        const LinkedParticleMCParticleLinks&) const override;
 
 protected:
-
 private:
-/// Name of the GiGa service
-  std::string m_gigaSvcName ;
-  /// Name of the GiGaCnv service
-  std::string m_kineSvcName ;
-  /// Name of the output location of MCHits
-  std::string m_hitsLocation ;
-  /// Name of the G4 hits collection
-  std::string m_colName ;
-  /// Name of the MCParticles location
-  std::string m_mcParticles ;
-
-  /// Pointer to the GiGa service
-  IGiGaSvc * m_gigaSvc ;
-  /// Pointer to the GiGaKine service
-  IGiGaKineCnvSvc * m_gigaKineCnvSvc ;
+    Gaudi::Property<std::string> m_colName{this, "CollectionName", ""};
 };
-#endif // GAUSSCALO_GETCALOHITSALG_H
diff --git a/Sim/GaussCalo/src/HcalSensDet.cpp b/Sim/GaussCalo/src/HcalSensDet.cpp
index 1371063b0bc6031607ee5b82e133f46a92438426..81f349294d733b7036e088ccd9e203673d02cb03 100755
--- a/Sim/GaussCalo/src/HcalSensDet.cpp
+++ b/Sim/GaussCalo/src/HcalSensDet.cpp
@@ -9,27 +9,13 @@
 #include "CLHEP/Units/PhysicalConstants.h"
 
 // from Gaudi
+#include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/SmartDataPtr.h"
-#include "GaudiKernel/IDataProviderSvc.h"
 
 // LHCb
 #include "LHCbMath/LHCbMath.h"
 
-// Gauss
-#include "GaussTools/GaussTrackInformation.h"
-
-// Geant4
-#include "Geant4/G4Step.hh"
-#include "Geant4/G4TouchableHistory.hh"
-#include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
-#include "Geant4/G4EnergyLossTables.hh"
-
-// GiGaCnv
-#include "GiGaCnv/GiGaVolumeUtils.h"
-
 // CaloDet
 #include "CaloDet/DeCalorimeter.h"
 
@@ -52,27 +38,6 @@
  */
 // ============================================================================
 
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( HcalSensDet )
-
-// ============================================================================
-/** standard constructor
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see AlgTool
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-HcalSensDet::HcalSensDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector( name  )
-  , EHCalSensDet        ( type , name , parent )
-{}
-
 // ============================================================================
 /** fill the hit with the concrete information about the energy and the time.
  *  The function is to be called from ProcessHits method.
@@ -92,49 +57,98 @@ HcalSensDet::HcalSensDet
  *
  */
 // ============================================================================
-StatusCode    HcalSensDet::fillHitInfo
-( CaloSubHit*                    hit           ,
-  const HepGeom::Point3D<double>& /* prePoint */   ,
-  const double                   time          ,
-  const double                   deposit       ,
-  const G4Track*                 track         ,
-  const G4ParticleDefinition*    particle      ,
-  const G4MaterialCutsCouple*    material      ,
-  const G4Step*                  step          ) const
-{
-
-  if( 0 == hit || 0 == step ) { return StatusCode::FAILURE ; }
+template <typename CELLGETTER>
+bool HcalSensDet<CELLGETTER>::fillHitInfo(
+    CaloSubHit* hit, const HepGeom::Point3D<double>& /* prePoint */,
+    const double time, const double deposit, const G4Track* track,
+    const G4ParticleDefinition* particle, const G4MaterialCutsCouple* material,
+    const G4Step* step) const {
+  if (0 == hit || 0 == step) {
+    return false;
+  }
 
   // Birk's Law Correction
-  const double energy = deposit *
-    birkCorrection ( particle                   ,
-                     track->GetKineticEnergy () ,
-                     material                   ) ;
+  const double energy =
+      deposit *
+      this->birkCorrection(particle, track->GetKineticEnergy(), material);
 
   // get the cell
-  const LHCb::CaloCellID& cellID = hit->cellID() ;
+  const LHCb::CaloCellID& cellID = hit->cellID();
 
   // add current energy deposition to the sub-hit
-  CaloSubHit::Time slot = 0   ;
+  CaloSubHit::Time slot = 0;
+
+  typename base_class::Fractions fractions;
+  bool sc = timing(time, cellID, slot, fractions);
+
+  if (!sc) {
+    this->error("Error from timing()");
+    return false;
+  }
+  if (fractions.empty()) {
+    this->warning("The empty vector of fractions()");
+  }
+
+  for (auto fr : fractions) {
+    if (fr > 1.e-5) {
+      hit->add(slot, energy * fr);
+    }
+  }
 
-  Fractions  fractions ;
-  StatusCode sc = timing ( time , cellID , slot , fractions ) ;
+  return true;
+}
 
-  if ( sc.isFailure()    ) { return Error ( "Error from timing()" , sc ) ; }
-  if ( fractions.empty() )
-    { Warning("The empty vector of fractions()"); }
+//=============================================================================
+// The fractions of energy deposited in consequitive time-slots
+// in the given Ecal/Hcal cell
+//=============================================================================
+template <typename CELLGETTER>
+bool HcalSensDet<CELLGETTER>::timing(
+    const double time, const LHCb::CaloCellID& cell, CaloSubHit::Time& slot,
+    typename base_class::Fractions& fractions) const {
+  // clear input data
+  slot = 0;
+  fractions.clear();
+
+  // evaluate the real delta time
+  const double deltaT = time - this->t0(cell);
+
+  // find the absolute time slot
+  slot = (CaloSubHit::Time)floor(deltaT / m_slotWidth);
+
+  // the time into the slot
+  const double dt = deltaT - slot * m_slotWidth;
+
+  for (auto histo : this->histos()) {
+    const int bin = histo->coordToIndex(dt / CLHEP::ns);
+    const double frac = histo->binHeight(bin);
+    fractions.push_back(frac);
+  };
+
+  if (fractions.empty()) {
+    this->warning("timing()::no time information is available!");
+  }
+
+  return true;
+}
 
-  for( Fractions::const_iterator ifr = fractions.begin() ;
-       fractions.end() != ifr ; ++ifr , ++slot )
-    {
-      const double fr = *ifr ;
-      if( fr > 1.e-5 ) { hit->add( slot , energy * fr ) ; }
-    }
+#include "CaloSensDetFAC.h"
 
-  return StatusCode::SUCCESS ;
-}
+template <typename CELLGETTER>
+class HcalSensDetFAC : public CaloSensDetFAC<HcalSensDet<CELLGETTER>> {
+  Gaudi::Property<double> m_slotWidth{this, "SlotWidth", 25 * CLHEP::ns};
 
+  public:
+  using calotype = HcalSensDet<CELLGETTER>;
+  using base = CaloSensDetFAC<calotype>;
+  using typename base::CaloSensDetFAC;
+  virtual calotype* construct() const override {
+    auto tmp = base::construct();
+    tmp->m_slotWidth = m_slotWidth;
+    return tmp;
+  }
+};
 
-// ============================================================================
-// The END
-// ============================================================================
+// Declaration of the Tool Factory
+typedef HcalSensDetFAC<CellFromLHCbGeo> HcalSensDetLHCbGeoFAC;
+DECLARE_COMPONENT_WITH_ID(HcalSensDetLHCbGeoFAC, "HcalSensDet")
diff --git a/Sim/GaussCalo/src/HcalSensDet.h b/Sim/GaussCalo/src/HcalSensDet.h
index 23234a7ce7fcf89feddcf3415a7350891505a236..bf74ae96d554bc1ef60a7bcf243016e71a6e3ae0 100755
--- a/Sim/GaussCalo/src/HcalSensDet.h
+++ b/Sim/GaussCalo/src/HcalSensDet.h
@@ -1,20 +1,14 @@
-// $Id: HcalSensDet.h,v 1.4 2007-01-12 15:24:49 ranjard Exp $
-#ifndef       GAUSSCALO_HcalSensDet_H
-#define       GAUSSCALO_HcalSensDet_H 1
+#pragma once
 
 // GaudiKernel
 /// Ntupel Svc
 #include "GaudiKernel/INTuple.h"
 #include "GaudiKernel/INTupleSvc.h"
 #include "GaudiKernel/NTuple.h"
-/// GiGa
-#include "GiGa/GiGaSensDetBase.h"
 /// local
-#include "CaloSim.h"
 #include "CaloHit.h"
-#include "EHCalSensDet.h"
-
-class DeCalorimeter ;
+#include "CaloSensDet.h"
+#include "CaloSim.h"
 
 /** @class HcalSensDet HcalSensDet.h
  *
@@ -25,11 +19,13 @@ class DeCalorimeter ;
  *  @date    23/01/2001
  */
 
-class HcalSensDet: public EHCalSensDet
-{
-
-protected:
+template <typename CELLGETTER>
+class HcalSensDet : public CaloSensDet<CELLGETTER> {
+  public:
+  using base_class = CaloSensDet<CELLGETTER>;
+  using base_class::CaloSensDet;
 
+  protected:
   /** fill the hit with the concrete information about the energy and the time.
    *  The function is to be called from ProcessHits method.
    *
@@ -48,43 +44,26 @@ protected:
    *                    etc for efficiency reasons.
    *
    */
-  StatusCode    fillHitInfo
-  ( CaloSubHit*                 hit         ,
-    const HepGeom::Point3D<double>& prePoint    ,
-    const double                globalTime  ,
-    const double                deposit     ,
-    const G4Track*              track       ,
-    const G4ParticleDefinition* pdef        ,
-    const G4MaterialCutsCouple* material    ,
-    const G4Step*               step        ) const override;
+  bool fillHitInfo(CaloSubHit* hit, const HepGeom::Point3D<double>& prePoint,
+                   const double globalTime, const double deposit,
+                   const G4Track* track, const G4ParticleDefinition* pdef,
+                   const G4MaterialCutsCouple* material,
+                   const G4Step* step) const override;
 
-public:
-
-  /** standard constructor
+  /** The fractions of energy deposited in consequitive time-bins
+   *  in the given Ecal/Hcal cell
    *  @see CaloSensDet
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
+   *  @param time global time of energy deposition
+   *  @param cell cellID of the cell
+   *  @param slot (out) the first time bin
+   *  @param fracs (out) the vector of fractions for subsequent time-slots;
+   *  @return StatuscCode
    */
-  HcalSensDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~HcalSensDet() {};
-
-private:
-
-  // no default constructor
-  HcalSensDet() ;
-  // no copy constructor
-  HcalSensDet           ( const HcalSensDet& );
-  // no assignement
-  HcalSensDet& operator=( const HcalSensDet& ) ;
+  bool timing(
+      const double time, const LHCb::CaloCellID& cell, CaloSubHit::Time& slot,
+      typename CaloSensDet<CELLGETTER>::Fractions& fractions) const override;
 
+  public:
+  /// width of time-slot (25ns)
+  double m_slotWidth{25 * CLHEP::ns};
 };
-#endif  ///< GAUSSCALO_HcalSensDet_H
diff --git a/Sim/GaussCalo/src/SpdPrsSensDet.cpp b/Sim/GaussCalo/src/SpdPrsSensDet.cpp
index f3738d194bb47026e7ba68d68ba302c8df7e94a2..6c2dd3d782e1f383d462e9d8444cbdb8fc52dc04 100755
--- a/Sim/GaussCalo/src/SpdPrsSensDet.cpp
+++ b/Sim/GaussCalo/src/SpdPrsSensDet.cpp
@@ -15,7 +15,7 @@
 #include "GaudiKernel/IHistogramSvc.h"
 
 // GaussTools
-#include "GaussTools/GaussTrackInformation.h"
+#include "GiGaMTCoreTruth/GaussinoTrackInformation.h"
 
 // Geant4
 #include "Geant4/G4Step.hh"
@@ -26,9 +26,6 @@
 #include "Geant4/G4EnergyLossTables.hh"
 #include "Geant4/G4MaterialCutsCouple.hh"
 
-// GiGaCnv
-#include "GiGaCnv/GiGaVolumeUtils.h"
-
 // CaloDet
 #include "CaloDet/DeCalorimeter.h"
 
@@ -55,66 +52,7 @@
  */
 // ============================================================================
 
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( SpdPrsSensDet )
 
-// ============================================================================
-/** standard constructor
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see AlgTool
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-SpdPrsSensDet::SpdPrsSensDet
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : G4VSensitiveDetector( name  )
-  , CaloSensDet        ( type , name , parent )
-  , m_BX ( 25. * CLHEP::ns )
-  , m_numBXs (6)
-  , m_sDelays ( 3, 0. )
-  , m_fracMin ( 1.e-5 )
-  , m_multiChargedBirks ( true )
-{
-  declareProperty ( "BunchCrossing"     ,  m_BX      ) ;
-  declareProperty ( "NumberBXs"         ,  m_numBXs  ) ;
-  declareProperty ( "IntegrationDelays" ,  m_sDelays ) ;
-  declareProperty ( "FracMin"           ,  m_fracMin ) ;
-}
-
-// ============================================================================
-/** standard initialization (Gaudi)
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see   AlgTool
- *  @see  IAlgTool
- *  @return statsu code
- */
-// ============================================================================
-StatusCode SpdPrsSensDet::initialize   ()
-{
-  return CaloSensDet::initialize();
-}
-
-// ============================================================================
-/** standard finalization (Gaudi)
- *  @see GiGaSensDetBase
- *  @see GiGaBase
- *  @see   AlgTool
- *  @see  IAlgTool
- *  @return statsu code
- */
-// ============================================================================
-StatusCode SpdPrsSensDet::finalize    ()
-{
-  m_sDelays.clear () ;
-  // finalize the base class
-  return CaloSensDet::finalize();
-}
 
 // ============================================================================
 /** fill the hit with the concrete information about the energy and the time.
@@ -135,7 +73,8 @@ StatusCode SpdPrsSensDet::finalize    ()
  *
  */
 // ============================================================================
-StatusCode    SpdPrsSensDet::fillHitInfo
+template <typename CELLGETTER>
+bool SpdPrsSensDet<CELLGETTER>::fillHitInfo
 ( CaloSubHit*                     hit,
   const HepGeom::Point3D<double>& /* prePoint   */,
   const double                    globalTime,
@@ -145,11 +84,11 @@ StatusCode    SpdPrsSensDet::fillHitInfo
   const G4MaterialCutsCouple*     material,
   const G4Step*                   /* step       */) const
 {
-  if ( 0 == hit ) { return StatusCode::FAILURE ; }
+  if ( 0 == hit ) { return false; }
 
   // Birks' Law Correction
   double edep = deposit ;
-  edep *= birkCorrection
+  edep *= this->birkCorrection
     ( particle                  ,
       track->GetKineticEnergy() ,
       material                  ) ;
@@ -157,19 +96,19 @@ StatusCode    SpdPrsSensDet::fillHitInfo
   // add the current energy deposition to the sub-hit
   // smearing the energy deposition over a number of bunch crossings (timing)
   CaloSubHit::Time slot;
-  CaloSensDet::Fractions frac;
+  typename CaloSensDet<CELLGETTER>::Fractions frac;
   frac.reserve( m_numBXs ) ;
 
   const LHCb::CaloCellID cellID = hit->cellID();
 
-  StatusCode sc = timing( globalTime , cellID , slot , frac );
-  if ( sc.isFailure() )
-  { return Error ( "Could not smear Edep!" , sc ) ; }
+  bool sc = timing( globalTime , cellID , slot , frac );
+  if ( !sc )
+  { this->error ( "Could not smear Edep!" ) ; }
 
   for( unsigned int i = 0; i < frac.size(); i++, slot += 1 )
   { if ( frac[i] > m_fracMin ) { hit->add( slot, edep*frac[i] ) ; } }
 
-  return StatusCode::SUCCESS ;
+  return true;
 }
 // ============================================================================
 /** The fractions of energy deposited in consequitive time-slots
@@ -178,16 +117,17 @@ StatusCode    SpdPrsSensDet::fillHitInfo
  *  @param cell cellID of the cell
  *  @param slot (out) the first time slot
  *  @param fracs the vector of fractions for subsequent time-slots;
- *  @return StatusCode
+ *  @return bool
  */
 // ============================================================================
-StatusCode SpdPrsSensDet::timing
+template <typename CELLGETTER>
+bool SpdPrsSensDet<CELLGETTER>::timing
 ( const double             time      ,
   const LHCb::CaloCellID&  cell      ,
   CaloSubHit::Time&        slot      ,
-  CaloSensDet::Fractions&  fractions ) const
+  typename CaloSensDet<CELLGETTER>::Fractions&  fractions ) const
 {
-  const double locTime = time - t0( cell );
+  const double locTime = time - this->t0( cell );
 
   // number of the current 25 ns bx w.r.t. local time
   slot = static_cast<CaloSubHit::Time>( floor( locTime/m_BX ) );
@@ -197,7 +137,7 @@ StatusCode SpdPrsSensDet::timing
   // which area the cell is in: 0-Outer, 1-Middle, 2-Inner
   const unsigned int area = cell.area();
 
-  const IAxis & axis = histos()[area]->axis();
+  const IAxis & axis = this->histos()[area]->axis();
   const double lowerEdge = axis.lowerEdge();
   const double upperEdge = axis.upperEdge();
 
@@ -207,16 +147,41 @@ StatusCode SpdPrsSensDet::timing
        i++, t += m_BX )
     if( lowerEdge < t && t < upperEdge )
     {
-      fractions.push_back( histos()[area]->binHeight( axis.coordToIndex(t) ) );
+      fractions.push_back( this->histos()[area]->binHeight( axis.coordToIndex(t) ) );
     }
     else fractions.push_back(0.);
 
   slot -= 1;
 
-  return StatusCode::SUCCESS ;
+  return true ;
 }
-// ============================================================================
 
-// ============================================================================
-// The END
-// ============================================================================
+#include "CaloSensDetFAC.h"
+
+template <typename CELLGETTER>
+class SpdPrsSensDetFAC
+    : public CaloSensDetFAC<SpdPrsSensDet<CELLGETTER>> {
+  Gaudi::Property<double> m_BX{this, "BunchCrossing", 25. * CLHEP::ns};
+  Gaudi::Property<unsigned int> m_numBXs{this, "NumberBXs", 6};
+  Gaudi::Property<std::vector<double>> m_sDelays{
+      this, "IntegrationDelays", {0, 0, 0}};
+  Gaudi::Property<double> m_fracMin{this, "FracMin", 1.e-5};
+
+  public:
+  using calotype = SpdPrsSensDet<CELLGETTER>;
+  using base = CaloSensDetFAC<calotype>;
+  using typename base::CaloSensDetFAC;
+  virtual calotype* construct() const override {
+    auto tmp = base::construct();
+    tmp->m_BX = m_BX;
+    tmp->m_numBXs = m_numBXs;
+    tmp->m_sDelays = m_sDelays;
+    tmp->m_fracMin = m_fracMin;
+    return tmp;
+  }
+};
+
+
+// Declaration of the Tool Factory
+typedef SpdPrsSensDetFAC<CellFromLHCbGeo> SpdPrsSensDetLHCbGeoFAC;
+DECLARE_COMPONENT_WITH_ID( SpdPrsSensDetLHCbGeoFAC, "SpdPrsSensDet" )
diff --git a/Sim/GaussCalo/src/SpdPrsSensDet.h b/Sim/GaussCalo/src/SpdPrsSensDet.h
index a4aff6e1dd0d9d9f3cc8c54def37d3291f78ce03..b5dd98f22e16a4bcb8e8453eb4155bb244c48f3d 100755
--- a/Sim/GaussCalo/src/SpdPrsSensDet.h
+++ b/Sim/GaussCalo/src/SpdPrsSensDet.h
@@ -1,20 +1,16 @@
-// $Id: SpdPrsSensDet.h,v 1.7 2007-01-12 15:24:50 ranjard Exp $
-#ifndef       GAUSSCALO_SpdPrsSensDet_H
-#define       GAUSSCALO_SpdPrsSensDet_H 1
+#pragma once
 
 // GaudiKernel
 /// Ntupel Svc
 #include "GaudiKernel/INTuple.h"
 #include "GaudiKernel/INTupleSvc.h"
 #include "GaudiKernel/NTuple.h"
-/// GiGa
-#include "GiGa/GiGaSensDetBase.h"
 /// local
-#include "CaloSim.h"
 #include "CaloHit.h"
 #include "CaloSensDet.h"
+#include "CaloSim.h"
 
-class DeCalorimeter ;  // CaloDet
+class DeCalorimeter;  // CaloDet
 
 /** @class SpdPrsSensDet SpdPrsSensDet.h
  *
@@ -25,31 +21,13 @@ class DeCalorimeter ;  // CaloDet
  *  @date    23/01/2001
  */
 
-class SpdPrsSensDet: public CaloSensDet
-{
-
-public :
-
-  /** standard initialization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode initialize   () override;
-
-  /** standard finalization (Gaudi)
-   *  @see GiGaSensDetBase
-   *  @see GiGaBase
-   *  @see   AlgTool
-   *  @see  IAlgTool
-   *  @return status code
-   */
-  StatusCode finalize    () override;
-
-protected:
+template <typename CELLGETTER>
+class SpdPrsSensDet : public CaloSensDet<CELLGETTER> {
+  public:
+  using base_class = CaloSensDet<CELLGETTER>;
+  using base_class::CaloSensDet;
 
+  protected:
   /** fill the hit with the concrete information about the energy and the time.
    *  The function is to be called from ProcessHits method.
    *
@@ -67,15 +45,11 @@ protected:
    *                    particle definition,material etc for efficiency reasons.
    *
    */
-  StatusCode    fillHitInfo
-  ( CaloSubHit*                 hit         ,
-    const HepGeom::Point3D<double>& prePoint    ,
-    const double                globalTime  ,
-    const double                deposit     ,
-    const G4Track*              track       ,
-    const G4ParticleDefinition* pdef        ,
-    const G4MaterialCutsCouple* material    ,
-    const G4Step*               step        ) const override;
+  bool fillHitInfo(CaloSubHit* hit, const HepGeom::Point3D<double>& prePoint,
+                   const double globalTime, const double deposit,
+                   const G4Track* track, const G4ParticleDefinition* pdef,
+                   const G4MaterialCutsCouple* material,
+                   const G4Step* step) const override;
 
   /** The fractions of energy deposited in consequitive time-bins
    *  for the given calorimeter cell
@@ -83,16 +57,13 @@ protected:
    *  @param cell cellID of the cell
    *  @param slot (out) the first time slot
    *  @param fracs the vector of fractions for subsequent time-slots;
-   *  @return StatusCode
+   *  @return bool
    */
-  StatusCode timing
-  ( const double            time      ,
-    const LHCb::CaloCellID&       cell      ,
-    CaloSubHit::Time&       slot      ,
-    CaloSensDet::Fractions& fractions ) const override;
-
-public:
+  bool timing(
+      const double time, const LHCb::CaloCellID& cell, CaloSubHit::Time& slot,
+      typename CaloSensDet<CELLGETTER>::Fractions& fractions) const override;
 
+  public:
   /** standard constructor
    *  @see CaloSensDet
    *  @see GiGaSensDetBase
@@ -102,34 +73,20 @@ public:
    *  @param name name of the object
    *  @param parent  pointer to parent object
    */
-  SpdPrsSensDet
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
+  SpdPrsSensDet(const std::string& type, const std::string& name,
+                const IInterface* parent);
 
   /// destructor (virtual and protected)
-  virtual ~SpdPrsSensDet() {};
-
-private:
-
-  // no default constructor
-  SpdPrsSensDet() ;
-  // no copy constructor
-  SpdPrsSensDet           ( const SpdPrsSensDet& );
-  // no assignement
-  SpdPrsSensDet& operator=( const SpdPrsSensDet& ) ;
-
-private:
-  double                                      m_BX                ;
-  unsigned int                                m_numBXs                ;
-  std::vector<double>                         m_sDelays ;
-  double                                      m_fracMin                ;
-
-// flag controlling the correction C1'= 7.2/12.6 * C1
-// for multiply charged particles: == true  correction is applied
-//                                 == false  correction is not applied
-  bool                                      m_multiChargedBirks ;
+  virtual ~SpdPrsSensDet(){};
+
+  public:
+  double m_BX{25. * CLHEP::ns};
+  unsigned int m_numBXs{6};
+  std::vector<double> m_sDelays{{0, 0, 0}};
+  double m_fracMin{1.e-5};
+
+  // flag controlling the correction C1'= 7.2/12.6 * C1
+  // for multiply charged particles: == true  correction is applied
+  //                                 == false  correction is not applied
+  bool m_multiChargedBirks{true};
 };
-
-#endif  ///< GAUSSCALO_SpdPrsSensDet_H
-
diff --git a/Sim/GaussCherenkov/.gaudi_project_ignore b/Sim/GaussCherenkov/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussCore/.gaudi_project_ignore b/Sim/GaussCore/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussTools/GaussTools/DetTrackInfo.h b/Sim/GaussCore/GaussCore/DetTrackInfo.h
similarity index 100%
rename from Sim/GaussTools/GaussTools/DetTrackInfo.h
rename to Sim/GaussCore/GaussCore/DetTrackInfo.h
diff --git a/Sim/GaussCore/GaussCore/GaussTrackInformation.h b/Sim/GaussCore/GaussCore/GaussTrackInformation.h
new file mode 100755
index 0000000000000000000000000000000000000000..d9d83920eed1e974d8f5c13635f9da2954c1478e
--- /dev/null
+++ b/Sim/GaussCore/GaussCore/GaussTrackInformation.h
@@ -0,0 +1,177 @@
+#pragma once
+// ============================================================================
+/// STL
+#include <string>
+#include <vector>
+/// Geant4
+#include "Geant4/G4VUserTrackInformation.hh"
+/// GaussTools
+#include "DetTrackInfo.h"
+#include "Geant4/G4Allocator.hh"
+#include "GiGaMTCoreDet/GaussHitBase.h"
+
+/** @class GaussTrackInformation GaussTrackInformation.h
+ *
+ *  Class which is used to store auxilliary information about G4Track,
+ *
+ *  @author  Witek Pokorski Witold.Pokorski@cern.ch
+ *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
+ *  @date    23/02/2001
+ */
+
+///
+class GaussTrackInformation : public G4VUserTrackInformation {
+  public:
+  // the actual tyep of hit conatiner
+  typedef std::vector<GaussHitBase*> Hits;
+
+  public:
+  /** copy constructor
+   *  @param right object to be copied
+   */
+  GaussTrackInformation(const GaussTrackInformation& right);
+
+  /// destructor
+  virtual ~GaussTrackInformation(){ delete m_detInfo; };
+
+  /// clone (virtual constructor)
+  virtual GaussTrackInformation* clone() const;
+
+  /// overloaded operator new
+  inline void* operator new(size_t);
+
+  /// overloaded operator delete
+  inline void operator delete(void*);
+
+  /// needed by base class
+  void Print() const override{};
+
+  /// flag to append the step
+  inline bool appendStep() const { return m_appendStep; }
+
+  /** set new value for flag to append step
+   *  @param value new value of the flag
+   */
+  inline GaussTrackInformation& setAppendStep(const bool value) {
+    m_appendStep = value;
+    return *this;
+  }
+
+  /// flag to force the saving of track into traectory
+  inline bool toBeStored() const { return m_toBeStored; }
+
+  /** set new value for flag to force the saving track into trajectory
+   *  @param value new value of the flag
+   */
+  inline GaussTrackInformation& setToBeStored(const bool value) {
+    m_toBeStored = value;
+    return *this;
+  }
+
+  /// track created a hit
+  inline bool createdHit() const { return m_createdHit; }
+
+  /** set new value for flag
+   *  @param value new value of the flag
+   */
+  inline GaussTrackInformation& setCreatedHit(const bool value) {
+    m_createdHit = value;
+    return *this;
+  }
+
+  // Retrieve if direct parent particle has been stored or not
+  inline bool directParent() const { return m_directParent; }
+
+  // Set if direct parent particle has been stored or not
+  inline GaussTrackInformation& setDirectParent(const bool value) {
+    m_directParent = value;
+    return *this;
+  }
+
+  /// Get flag to store or not in internal HepMC structure
+  inline bool storeHepMC() const { return m_storeHepMC; }
+
+  /// Set value of flag to store or not in internal HepMC structure
+  inline GaussTrackInformation& setStoreHepMC(const bool value) {
+    m_storeHepMC = value;
+    return *this;
+  }
+
+  /** add hit pointer
+   *  @param hit hit to be added into list of connected hits
+   */
+  GaussTrackInformation& addHit(GaussHitBase* hit) {
+    if (0 != hit) {
+      m_hits.push_back(hit);
+    };
+    return *this;
+  }
+
+  /** add hit pointer
+   *  @param hit hit to be added into list of connected hits
+   */
+  GaussTrackInformation& addToHits(GaussHitBase* hit) { return addHit(hit); }
+
+  // get the container of hits
+  const Hits& hits() const { return m_hits; }
+
+  /** update Tracks IDs in hits
+   *  (set the new track ID for all connected hits)
+   *  @param trackID new value of trackID
+   */
+  GaussTrackInformation& updateHitsTrackID(G4int trackID) {
+    for (Hits::iterator ihit = m_hits.begin(); m_hits.end() != ihit; ++ihit) {
+      GaussHitBase* hit = *ihit;
+      if (0 != hit) {
+        hit->setTrackID(trackID);
+      }
+    }
+    return *this;
+  }
+
+  /** get the pointer to the detInfo
+   */
+  DetTrackInfo* detInfo() const { return m_detInfo; }
+
+  /** set the pointer to the detInfo
+   *  @param aDetInfo pointer to DetTrackInfo
+   */
+  void setDetInfo(DetTrackInfo* aDetInfo) { m_detInfo = aDetInfo; }
+
+  inline static G4Allocator<GaussTrackInformation>*
+  GaussTrackInformationAllocator();
+
+  private:
+  /// flag indicating that TrajectoryPoint should be appended
+  bool m_appendStep{false};
+  /// flag indicating that track is forced to be stored into trajectory
+  bool m_toBeStored{false};
+  /// flag indicating that track created a hit
+  bool m_createdHit{false};
+  /// flag indicating that the direct parent particle was not stored
+  /// in HepMC event this will be represented by a special 'dummy' link
+  bool m_directParent{true};
+  // flag indicating that the track should be stored in HepMC record
+  bool m_storeHepMC{false};
+
+  /// vector of pointers to hits created by that track
+  Hits m_hits{};
+
+  /// pointer to a specialised DetTrackInfo object containing detector-specific
+  /// track information
+  DetTrackInfo* m_detInfo{nullptr};
+};
+
+inline G4Allocator<GaussTrackInformation>*
+GaussTrackInformation::GaussTrackInformationAllocator() {
+  thread_local auto hitAllocator = G4Allocator<GaussTrackInformation>{};
+  return &hitAllocator;
+}
+
+inline void* GaussTrackInformation::operator new(size_t) {
+  return (void*)GaussTrackInformationAllocator()->MallocSingle();
+}
+
+inline void GaussTrackInformation::operator delete(void* info) {
+  GaussTrackInformationAllocator()->FreeSingle((GaussTrackInformation*)info);
+}
diff --git a/Sim/GaussCore/src/Lib/GaussTrackInformation.cpp b/Sim/GaussCore/src/Lib/GaussTrackInformation.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..2ecf71496b5edf41f126b5f8d285b8861acb9b9d
--- /dev/null
+++ b/Sim/GaussCore/src/Lib/GaussTrackInformation.cpp
@@ -0,0 +1,28 @@
+#include "GaussCore/GaussTrackInformation.h"
+
+// ============================================================================
+/** @file
+ *  Implementation file for class : GaussTrackInformation
+ *  @author  Witek Pokorski Witold.Pokorski@cern.ch
+ *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
+ *  @date    23/02/2001
+ */
+// ============================================================================
+
+GaussTrackInformation::GaussTrackInformation(const GaussTrackInformation& right)
+    : G4VUserTrackInformation(right),
+      m_appendStep(right.m_appendStep),
+      m_toBeStored(right.m_toBeStored),
+      m_createdHit(right.m_createdHit),
+      m_directParent(right.m_directParent),
+      m_storeHepMC(right.m_storeHepMC),
+      m_hits(right.m_hits),
+      m_detInfo(right.m_detInfo) {
+#ifdef GIGA_DEBUG
+  GaussTrackInformationLocal::s_Counter.increment();
+#endif
+}
+
+GaussTrackInformation* GaussTrackInformation::clone() const {
+  return new GaussTrackInformation(*this);
+}
diff --git a/Sim/GaussGeo/CMakeLists.txt b/Sim/GaussGeo/CMakeLists.txt
index 253dd9252b2de87a01dfa138e07f30eb9a129d71..2f1c1b3605ee25988da2c74516cf194cb00f0beb 100644
--- a/Sim/GaussGeo/CMakeLists.txt
+++ b/Sim/GaussGeo/CMakeLists.txt
@@ -4,13 +4,15 @@
 gaudi_subdir(GaussGeo v1r0)
 
 gaudi_depends_on_subdirs(Det/DetDesc
-                         Sim/GiGa)
+                         Sim/GiGaMTGeo)
 
 find_package(Boost)
 find_package(CLHEP)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS})
+FindG4libs(digits_hits event geometry global graphics_reps materials
+           particles processes run tracking track)
 
 gaudi_add_module(GaussGeo
                  src/component/*.cpp
-                 INCLUDE_DIRS Tools/ClhepTools
-                 LINK_LIBRARIES DetDescLib GiGaLib)
+                 INCLUDE_DIRS Tools/ClhepTools GiGaMTGeo
+                 LINK_LIBRARIES DetDescLib ${GEANT4_LIBS})
diff --git a/Sim/GaussGeo/GaussGeo/IGaussGeo.h b/Sim/GaussGeo/GaussGeo/IGaussGeo.h
index 9567af0c4f3b8f7c549f1a80c1d9f4eda1de7e74..65a9a3e64ca6d71f71ebf1e763e379f3ddbfeb55 100644
--- a/Sim/GaussGeo/GaussGeo/IGaussGeo.h
+++ b/Sim/GaussGeo/GaussGeo/IGaussGeo.h
@@ -1,5 +1,4 @@
-#ifndef  GAUSSGEO_IGAUSSGEO_H_
-#define  GAUSSGEO_IGAUSSGEO_H_
+#pragma once
 
 // GaudiKernel
 #include "GaudiKernel/IInterface.h"
@@ -20,5 +19,3 @@ class IGaussGeo : virtual public IInterface {
   // Retrieve the pointer to the G4 geometry tree root
   virtual G4VPhysicalVolume* world() = 0;
 };
-
-#endif  // GAUSSGEO_IGAUSSGEO_H_
diff --git a/Sim/GaussGeo/src/component/GaussGeo.cpp b/Sim/GaussGeo/src/component/GaussGeo.cpp
index fd4c98c99ec17ceab29e13e94f54a2d62b8f51aa..a4b33ccfdd518910d15de5ba0bbc136b959d2078 100644
--- a/Sim/GaussGeo/src/component/GaussGeo.cpp
+++ b/Sim/GaussGeo/src/component/GaussGeo.cpp
@@ -60,10 +60,11 @@
 #include "Geant4/G4SolidStore.hh"
 
 // GiGa
-#include "GiGa/IGiGaSensDet.h"
-#include "GiGa/IGiGaMagField.h"
-#include "GiGa/IGiGaFieldMgr.h"
-#include "GiGa/IGDMLReader.h"
+// FIXME: Need to integrate this
+//#include "GiGaMTFactories/GiGaMTG4SensDetFactory.h"
+//#include "GiGa/IGiGaMagField.h"
+//#include "GiGa/IGiGaFieldMgr.h"
+//#include "GiGa/IGDMLReader.h"
 
 // Local unclides
 #include "GaussGeo.h"
@@ -93,9 +94,9 @@ GaussGeo::GaussGeo(const std::string& service_name, ISvcLocator* service_locator
     m_data_selector(),
     m_world_root(nullptr),
     m_mag_field_mgr(""),
-    m_sensitive_detectors(),
-    m_magnetic_fields(),
-    m_mag_field_managers(),
+    //m_sensitive_detectors(),
+    //m_magnetic_fields(),
+    //m_mag_field_managers(),
     m_use_alignment(false),
     m_align_all(false),
     m_align_dets_names(),
@@ -174,30 +175,30 @@ StatusCode GaussGeo::initialize() {
     warning() << "Special run for material budget calculation requested!" << endmsg;
   }
 
-  // Retrieve GDMLReader tools
-  {
-    StatusCode sc = StatusCode::SUCCESS;
-    m_gdml_readers.clear();
-    for (const auto& reader : m_gdml_readers_names) {
-      if (reader == "") {
-        continue;
-      }
+  // FIXME: Retrieve GDMLReader tools
+  //{
+    //StatusCode sc = StatusCode::SUCCESS;
+    //m_gdml_readers.clear();
+    //for (const auto& reader : m_gdml_readers_names) {
+      //if (reader == "") {
+        //continue;
+      //}
 
-      IGDMLReader* gdml_tool = nullptr;
-      sc = toolSvc()->retrieveTool("GDMLReader/" + reader, gdml_tool, this);
-      if (sc.isFailure()) {
-        return reportError("Failed to retrieve a GDMLReader tool!", sc);
-      }
+      //IGDMLReader* gdml_tool = nullptr;
+      //sc = toolSvc()->retrieveTool("GDMLReader/" + reader, gdml_tool, this);
+      //if (sc.isFailure()) {
+        //return reportError("Failed to retrieve a GDMLReader tool!", sc);
+      //}
 
-      if (gdml_tool != nullptr) {
-        m_gdml_readers.push_back(gdml_tool);
-      }
-    }
+      //if (gdml_tool != nullptr) {
+        //m_gdml_readers.push_back(gdml_tool);
+      //}
+    //}
 
-    if (!m_gdml_readers.empty()) {
-      info() << "Retrieved " << m_gdml_readers.size() << " GDMLReader tools..." << endmsg;
-    }
-  }
+    //if (!m_gdml_readers.empty()) {
+      //info() << "Retrieved " << m_gdml_readers.size() << " GDMLReader tools..." << endmsg;
+    //}
+  //}
 
   // Print out names of geo items for debugging
   if (outputLevel() == MSG::VERBOSE) {
@@ -262,32 +263,30 @@ StatusCode GaussGeo::finalize() {
     verbose() << m_str_prefix << "=> Service Finilization Start" << endmsg;
   }
 
-  // Finalize all sensitive detectors
-  for (auto& idet : m_sensitive_detectors) {
-    IAlgTool* det = idet;
-    if (det != nullptr && toolSvc() != nullptr) {
-      toolSvc()->releaseTool(det);
-    }
-  }
-  m_sensitive_detectors.clear();
+  //// Finalize all sensitive detectors
+  //for (auto& idet : mmap_sensdet_to_lvols) {
+    //if(idet.first){
+      //idet.first->release();
+    //}
+  //}
 
   // Finalize magnetic field objects
-  for (auto& imf : m_magnetic_fields) {
-    IAlgTool* mf = imf;
-    if (mf != nullptr && toolSvc() != nullptr) {
-      toolSvc()->releaseTool(mf);
-    }
-  }
-  m_magnetic_fields.clear();
+  //for (auto& imf : m_magnetic_fields) {
+    //IAlgTool* mf = imf;
+    //if (mf != nullptr && toolSvc() != nullptr) {
+      //toolSvc()->releaseTool(mf);
+    //}
+  //}
+  //m_magnetic_fields.clear();
 
   // Finalize magnetic field manager objects
-  for (auto& imfmgr : m_mag_field_managers) {
-    IAlgTool* mfmgr = imfmgr;
-    if (mfmgr != nullptr && toolSvc() != nullptr) {
-      toolSvc()->releaseTool(mfmgr);
-    }
-  }
-  m_mag_field_managers.clear();
+  //for (auto& imfmgr : m_mag_field_managers) {
+    //IAlgTool* mfmgr = imfmgr;
+    //if (mfmgr != nullptr && toolSvc() != nullptr) {
+      //toolSvc()->releaseTool(mfmgr);
+    //}
+  //}
+  //m_mag_field_managers.clear();
 
   // Clear assembly store
   GaussGeoAssemblyStore::store()->clear();
@@ -349,8 +348,8 @@ StatusCode GaussGeo::queryInterface(const InterfaceID& iid, void** ppi) {
     return StatusCode::FAILURE;
   }
 
-  if (iid == IGiGaGeoSrc::interfaceID()) {
-    *ppi = static_cast<IGiGaGeoSrc*>(this);
+  if (iid == IGiGaMTGeoSvc::interfaceID()) {
+    *ppi = static_cast<IGiGaMTGeoSvc*>(this);
   } else if (iid == IIncidentListener::interfaceID()) {
     *ppi = static_cast<IIncidentListener*>(this);
   } else if (iid == IService::interfaceID()) {
@@ -502,7 +501,7 @@ StatusCode GaussGeo::convertDetectorElementObject(DataObject* object) {
     return reportError("Failed to convert logical volume " + lvolume->name());
   }
 
-  G4VPhysicalVolume* pvolume = world();
+  G4VPhysicalVolume* pvolume = constructWorld();
   if (pvolume == nullptr) {
     return reportError("G4WorldPV is not available!");
   }
@@ -637,39 +636,19 @@ StatusCode GaussGeo::convertLVolumeObject(DataObject* object) {
 
   // Sensitivity
   if (!lvolume->sdName().empty()) {
-    if (g4_volume->GetSensitiveDetector() == nullptr) {
-      IGiGaSensDet* sens_det = nullptr;
-      StatusCode sc = sensitive(lvolume->sdName(), sens_det);
-
-      if (sc.isFailure() || sens_det == nullptr) {
-        return reportError("Failed to create SensDet", sc);
-      }
-
-      // Set sensitive detector
-      g4_volume->SetSensitiveDetector(sens_det);
-    } else {
-      warning() << "SensDet is already defined!'" << endmsg;
+    auto sc = register_sensitive(lvolume->sdName(), g4_volume);
+    if(sc.isFailure()){
+      return reportError("Failed to set '" + lvolume->sdName() + "' for '"+ lvolume->name() + "'");
     }
   }
 
   // Magnetic field
+  // FIXME: Field stuff
   if (!lvolume->mfName().empty()) {
-    IGiGaFieldMgr* fmanager = nullptr;
-    StatusCode sc = fieldMgr(lvolume->mfName(), fmanager);
-    if (sc.isFailure() || fmanager == nullptr) {
-      return reportError("Failed to create FieldMgr!", sc);
+    auto sc = register_mag_field(lvolume->mfName(), g4_volume);
+    if(sc.isFailure()){
+      return reportError("Failed to set '" + lvolume->mfName() + "' for '"+ lvolume->name() + "'");
     }
-
-    if (fmanager->fieldMgr() == nullptr) {
-      return reportError("FieldMgr is invalid!");
-    }
-
-    if (fmanager->global()) {
-      return reportError("FieldMgr is 'global'!");
-    }
-
-    // Set magnetic field manager
-    g4_volume->SetFieldManager(fmanager->fieldMgr(), false);
   }
 
   // Check the G4 static store
@@ -1464,9 +1443,9 @@ G4VSolid* GaussGeo::solidBoolToG4Solid(const SolidBoolean* solid_bool) {
 //=============================================================================
 // Retrieve the pointer to G4 geometry tree root
 //=============================================================================
-G4VPhysicalVolume* GaussGeo::world() {
+G4VPhysicalVolume* GaussGeo::constructWorld() {
   if (outputLevel() == MSG::VERBOSE) {
-    verbose() << m_str_prefix << "world()" << endmsg;
+    verbose() << m_str_prefix << "constructWorld()" << endmsg;
   }
 
   if (m_world_root != nullptr) {
@@ -1489,55 +1468,15 @@ G4VPhysicalVolume* GaussGeo::world() {
   m_world_root = new G4PVPlacement(0, CLHEP::Hep3Vector(), m_world_pv_name, world_logical_volume, 0, false, 0);
 
   // Import GDML geometry
-  for (const auto& reader : m_gdml_readers) {
-    reader->import(m_world_root);
-  }
+  // FIXME
+  //for (const auto& reader : m_gdml_readers) {
+    //reader->import(m_world_root);
+  //}
 
+  //FIXME Field stuff
   if (!m_mag_field_mgr.empty()) {
-    IGiGaFieldMgr* giga_fmanager = nullptr;
-    StatusCode sc = fieldMgr(m_mag_field_mgr, giga_fmanager);
-    if (sc.isFailure() || giga_fmanager == nullptr) {
-      error() << "Faild to construct GiGaFieldManager '" << m_mag_field_mgr << "'" << endmsg;
-      return nullptr;
-    }
-
-    if (!giga_fmanager->global()) {
-      error() << "GiGaFieldManager '" + m_mag_field_mgr + "' is not 'global'" << endmsg;
-      return nullptr;
-    }
-
-    if (giga_fmanager->fieldMgr() ==  nullptr) {
-      error() << "GiGaFieldManager '" + m_mag_field_mgr + "' has invalid G4FieldManager" << endmsg;
-      return nullptr;
-    }
-
-    if (giga_fmanager->field() == nullptr) {
-      error() << "GiGaFieldManager '" + m_mag_field_mgr + "' has invalid G4MagneticField" << endmsg;
-      return nullptr;
-    }
-
-    if (giga_fmanager->stepper() == nullptr) {
-      error() << "GiGaFieldManager '" + m_mag_field_mgr + "' has invalid G4MagIntegratorStepper" << endmsg;
-      return nullptr;
-    }
+    register_mag_field(m_mag_field_mgr, nullptr);
 
-    // Additional check
-    G4TransportationManager* trans_manager = G4TransportationManager::GetTransportationManager();
-    if (trans_manager == nullptr) {
-      error() << "G4TransportationMgr is invalid!" << endmsg;
-      return nullptr;
-    }
-
-    if (trans_manager->GetFieldManager() != giga_fmanager->fieldMgr()) {
-      error() << "Mismatch in the G4FieldManager!" << endmsg;
-      return nullptr;
-    }
-
-    info() << "Global 'Field Manager' is set to '" << objectTypeName(giga_fmanager)
-           << "/" << giga_fmanager->name() << "'" << endmsg;
-    info() << "Global 'G4Field Manager' is set to '" << objectTypeName(giga_fmanager->fieldMgr()) << "'" << endmsg;
-    info() << "Global 'G4MagneticField' is set to '" << objectTypeName(giga_fmanager->field()) << "'" << endmsg;
-    info() << "Global 'G4MagIntegratorStepper' is set to '" << objectTypeName(giga_fmanager->stepper()) << "'" << endmsg;
   } else {
     warning() << "Magnetic Field was not requested to be loaded" << endmsg;
   }
@@ -1545,16 +1484,6 @@ G4VPhysicalVolume* GaussGeo::world() {
   return m_world_root;
 }
 
-//=============================================================================
-// Retrieve the pointer to G4 geometry tree root
-// Obsolete method, for compatibility with IGiGaGeoSrc interface
-//=============================================================================
-G4VPhysicalVolume* GaussGeo::G4WorldPV() {
-  warning() << "G4WorldPV() is obsolete, use world()!" << endmsg;
-
-  return world();
-}
-
 //=============================================================================
 // Create a new G4LogicalVolume
 //=============================================================================
@@ -1583,14 +1512,7 @@ G4LogicalVolume* GaussGeo::createG4LVolume(G4VSolid* g4_solid, G4Material* g4_ma
 
   // Look for global material budget counter
   if (!m_budget.empty()) {
-    IGiGaSensDet* budget = 0;
-    StatusCode sc = sensitive(m_budget, budget);
-
-    if (sc.isFailure() || budget == nullptr) {
-      error() << "Failed to get Material Budget '" << m_budget << "'" << endmsg;
-    } else {
-      g4_lvolume->SetSensitiveDetector(budget);
-    }
+    register_sensitive(m_budget, g4_lvolume);
   }
 
   if (outputLevel() == MSG::VERBOSE) {
@@ -1598,6 +1520,10 @@ G4LogicalVolume* GaussGeo::createG4LVolume(G4VSolid* g4_solid, G4Material* g4_ma
     prefixOut();
   }
 
+  debug() << "Created G4LogicalVolume: " << g4_lvolume->GetName() << endmsg;
+  if(!G4LogicalVolumeStore::GetInstance()->GetVolume(volume_name, true)){
+      error() << "Not in STORE!!!!!!!!!!!!!!!!!!!!!!!!!" << endmsg;
+  };
   return g4_lvolume;
 }
 
@@ -1751,68 +1677,97 @@ StatusCode GaussGeo::installVolume(G4LogicalVolume* g4_volume, const std::string
 //=============================================================================
 // Instantiate a Sensitive Detector object
 //=============================================================================
-StatusCode GaussGeo::sensitive(const std::string& name, IGiGaSensDet*& detector) {
-  if (outputLevel() == MSG::VERBOSE) {
-    prefixIn();
-    verbose() << m_str_prefix << "=> sensitive(): " << name << endmsg;
-  }
-
-  // Reset the output value
-  detector = nullptr;
-
-  // Locate the detector
-  detector = getTool(name, detector, this);
-  if (detector == nullptr) {
-    return reportError("Failed to locate Sensitive Detector '" + name + "'");
-  }
-
-  // Inform G4 sensitive detector manager
-  if (std::find(m_sensitive_detectors.begin(), m_sensitive_detectors.end(), detector) == m_sensitive_detectors.end()) {
-    G4SDManager* sd_manager = G4SDManager::GetSDMpointer();
-    if (sd_manager == nullptr) {
-      return reportError("Failed to locate G4SDManager!");
+StatusCode GaussGeo::register_sensitive(const std::string& name, G4LogicalVolume* vol) {
+  // First check if we have already obtained the sensitive detector factory for the
+  // provided name.
+  auto it = mmap_name_to_sensdetfac.find(name);
+  if(it == std::end(mmap_name_to_sensdetfac)){
+    mmap_name_to_sensdetfac[name] = nullptr;
+    getTool(name, mmap_name_to_sensdetfac[name], this);
+    // Check if successful
+    if(!mmap_name_to_sensdetfac[name]){
+      warning() << "Could not retrieve sensitive detector " << name << "." << endmsg;
+      warning() << "What do we say to the geo service? Not today ..." << endmsg;
     }
-    sd_manager->AddNewDetector(detector);
   }
-
-  // Keep a local copy
-  m_sensitive_detectors.push_back(detector);
-
-  if (outputLevel() == MSG::VERBOSE) {
-    verbose() << m_str_prefix << "<= sensitive()" << endmsg;
-    prefixOut();
+  // Now fill the map of identified sensitive detectors to volumes
+  if(auto & sensdet = mmap_name_to_sensdetfac[name]; sensdet){
+    if(mmap_sensdet_to_lvols.find(sensdet) == std::end(mmap_sensdet_to_lvols)){
+      mmap_sensdet_to_lvols[sensdet] = {};
+    }
+    mmap_sensdet_to_lvols[sensdet].insert(vol);
+    if(vol){
+      debug() << "Asked to use sens det " << name << " for " << vol->GetName() << "" << endmsg;
+    }
   }
-
   return StatusCode::SUCCESS;
 }
 
 //=============================================================================
-// Instantiate a Magnetic Field object
+// Instantiate a Magnetic Field Factories
 //=============================================================================
-StatusCode GaussGeo::fieldMgr(const std::string& name, IGiGaFieldMgr*& fmanager) {
-  if (outputLevel() == MSG::VERBOSE) {
-    prefixIn();
-    verbose() << m_str_prefix << "=> fieldMgr(): " << name << endmsg;
+StatusCode GaussGeo::register_mag_field(const std::string& name, G4LogicalVolume* vol) {
+  // First check if we have already obtained the magnetic field factory for the
+  // provided name.
+  if(!vol && m_found_global_fieldmgr){
+    error() << "Tried to register second global magnetic field manager" << endmsg;
+    return StatusCode::FAILURE;
+  }
+  auto it = mmap_name_to_fieldmgrfac.find(name);
+  if(it == std::end(mmap_name_to_fieldmgrfac)){
+    mmap_name_to_fieldmgrfac[name] = nullptr;
+    getTool(name, mmap_name_to_fieldmgrfac[name], this);
+    // Check if successful
+    if(!mmap_name_to_fieldmgrfac[name]){
+      warning() << "Could not field manager " << name << "." << endmsg;
+      warning() << "What do we say to the geo service? Not today ..." << endmsg;
+    }
   }
 
-  // Reset the output value
-  fmanager = nullptr;
-
-  // Locate the magnetic field tool
-  fmanager = getTool(name, fmanager, this);
-  if (fmanager == nullptr) {
-    return reportError("Failed to locate FieldManager '" + name + "'");
+  // Now fill the map of field managers to volumes
+  if(auto & fieldmgr = mmap_name_to_fieldmgrfac[name]; fieldmgr){
+    if(mmap_fieldmgr_to_lvols.find(fieldmgr) == std::end(mmap_fieldmgr_to_lvols)){
+      mmap_fieldmgr_to_lvols[fieldmgr] = {};
+    }
+    mmap_fieldmgr_to_lvols[fieldmgr].insert(vol);
+    if(vol){
+      debug() << "Asked to use field " << name << " for " << vol->GetName() << "" << endmsg;
+    }
+  }
+  if(!vol){
+    auto giga_fmanager = mmap_name_to_fieldmgrfac[name];
+    info() << "Global 'Field Manager' is set to '" << objectTypeName(giga_fmanager)
+           << "/" << giga_fmanager->name() << "'" << endmsg;
+    m_found_global_fieldmgr = true;
   }
+  
+  return StatusCode::SUCCESS;
+}
 
-  // Keep a local copy
-  m_mag_field_managers.push_back(fmanager);
+void GaussGeo::constructSDandField() {
+  auto sdmanager = G4SDManager::GetSDMpointer();
+  for(auto & [sensdetfac, vols]:  mmap_sensdet_to_lvols){
+    debug() << "Assigning " << sensdetfac->name() << " to " << vols.size() << " logical volumes" << endmsg;
+    auto sensdet = sensdetfac->construct();
+    sdmanager->AddNewDetector(sensdet);
+    for(auto * vol: vols){
+      vol->SetSensitiveDetector(sensdet);
+    }
+  }
+  for(auto & [fieldmgrfac, vols]:  mmap_fieldmgr_to_lvols){
+    //Catch the global field manager
+    if(vols.size() == 1 && *std::begin(vols) == nullptr){
+      debug() << "Constructing global " << fieldmgrfac->name() << "." << endmsg;
+      fieldmgrfac->construct(true);
+    } else {
+    auto fieldmgr = fieldmgrfac->construct(false);
+      debug() << "Assigning " << fieldmgrfac->name() << " to " << vols.size() << " logical volumes" << endmsg;
+      for(auto * vol: vols){
+        vol->SetFieldManager(fieldmgr, false);
+      }
+    }
 
-  if (outputLevel() == MSG::VERBOSE) {
-    verbose() << m_str_prefix << "<= fieldMgr()" << endmsg;
-    prefixOut();
   }
-
-  return StatusCode::SUCCESS;
 }
 
 //=============================================================================
diff --git a/Sim/GaussGeo/src/component/GaussGeo.h b/Sim/GaussGeo/src/component/GaussGeo.h
index 6247c00464e4490c57328430462284c648ce1628..a1900428241a4bf659e0e1e7a67b22f06476f6ae 100644
--- a/Sim/GaussGeo/src/component/GaussGeo.h
+++ b/Sim/GaussGeo/src/component/GaussGeo.h
@@ -1,5 +1,4 @@
-#ifndef  GAUSSGEO_GAUSSGEO_H_
-#define  GAUSSGEO_GAUSSGEO_H_
+#pragma once
 
 // Kernel includes
 #include "Kernel/IPropertyConfigSvc.h"
@@ -11,20 +10,25 @@
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/DataStoreItem.h"
 #include "GaudiKernel/IDataSelector.h"
+#include "GiGaMTFactories/GiGaFactoryBase.h"
+#include "Geant4/G4VSensitiveDetector.hh"
+#include "GaudiKernel/Transform3DTypes.h"
 
-// GiGa Geo Interface
-#include "GiGa/IGiGaGeoSrc.h"
-
+#include "GiGaMTGeo/IGiGaMTGeoSvc.h"
 // Forward declaration
 class GaussGeoVolume;
 class GaussGeoAssembly;
-class IGiGaSensDet;
-class IGiGaMagField;
-class IGiGaFieldMgr;
-class IGDMLReader;
 class G4Material;
 class G4VSolid;
 class G4LogicalVolume;
+class G4VPhysicalVolume;
+
+// Missing from the original
+struct ISolid;
+struct IPVolume;
+struct IDetectorElement;
+class SolidBoolean;
+class G4MaterialPropertiesTable;
 
 // ============================================================================
 // Interface file for class : GaussGeo
@@ -33,14 +37,14 @@ class G4LogicalVolume;
 // into GEANT4 format. Based on GiGaGeo convertion service.
 //
 // 2015-11-11 : Dmitry Popov
+// 2019-5-16 : Dominik Muller
 // ============================================================================
 
-class GaussGeo : public Service,
-                 virtual public IIncidentListener,
-                 virtual public IGiGaGeoSrc {
+class GaussGeo : public Service, virtual public IGiGaMTGeoSvc,
+                 virtual public IIncidentListener{
  public:
   GaussGeo(const std::string& service_name, ISvcLocator* service_locator);
-  virtual ~GaussGeo() {}
+  virtual ~GaussGeo() = default;
 
   // Service pure member functions
   StatusCode initialize() override;
@@ -52,8 +56,8 @@ class GaussGeo : public Service,
   void handle(const Incident& incident) override;
 
   // Pointer to the root of G4 geometry tree
-  G4VPhysicalVolume* world() override;
-  G4VPhysicalVolume* G4WorldPV() override;  // Obsolete method for IGiGeGeoSrc
+  G4VPhysicalVolume* constructWorld() override;
+  void constructSDandField() override;
 
  private:
   GaussGeo();
@@ -85,10 +89,6 @@ class GaussGeo : public Service,
 
   std::string m_budget;  // Special sensitive detector for estimation of material budget
 
-  std::vector<IGiGaSensDet*>  m_sensitive_detectors;
-  std::vector<IGiGaMagField*> m_magnetic_fields;
-  std::vector<IGiGaFieldMgr*> m_mag_field_managers;
-
   bool m_use_alignment;  // Flag to switch on use of condDB info for children detector elements
   bool m_align_all;  // Flag to switch on for which detector to use condDB info for children detector elements
   std::vector<std::string> m_align_dets_names;  // List of paths in TES to which to apply condDB info
@@ -100,7 +100,7 @@ class GaussGeo : public Service,
 
   // GDML readers to be called when creating world volume
   std::vector<std::string> m_gdml_readers_names;
-  std::vector<IGDMLReader*> m_gdml_readers;
+  //std::vector<IGDMLReader*> m_gdml_readers;
 
   // For verbose info printout beautification
   std::string m_str_prefix;
@@ -156,8 +156,18 @@ class GaussGeo : public Service,
   StatusCode installVolume(G4LogicalVolume* g4_volume, const std::string& name,
                            const Gaudi::Transform3D& matrix, G4LogicalVolume* mother_volume);
 
-  StatusCode sensitive(const std::string& name, IGiGaSensDet*& detector);
-  StatusCode fieldMgr(const std::string& name, IGiGaFieldMgr*& fmanager);
+  // Register that sensitive detector of given name is supposed to be
+  // associated to given logical volume during worker thread initialisation
+  std::map<GiGaFactoryBase<G4VSensitiveDetector>*, std::set<G4LogicalVolume*>> mmap_sensdet_to_lvols;
+  std::map<std::string, GiGaFactoryBase<G4VSensitiveDetector>*> mmap_name_to_sensdetfac;
+  std::map<GiGaFactoryBase<G4FieldManager,bool>*, std::set<G4LogicalVolume*>> mmap_fieldmgr_to_lvols;
+  std::map<std::string, GiGaFactoryBase<G4FieldManager,bool>*> mmap_name_to_fieldmgrfac;
+  StatusCode register_sensitive(const std::string& name, G4LogicalVolume*);
+  //FIXME: FIELD STUFF
+  StatusCode register_mag_field(const std::string& name, G4LogicalVolume*);
+  std::atomic_bool m_found_global_fieldmgr{false};
+  //StatusCode fieldMgr(const std::string& name, IGiGaFieldMgr*& fmanager);
+  //StatusCode fieldMgr(const std::string& name, IGiGaFieldMgr*& fmanager);
 
   // Methods to simplify tools retrieval
   template<class T>
@@ -172,5 +182,3 @@ class GaussGeo : public Service,
   int findBestDetElemFromPVName(std::string pv_name, std::vector<const IDetectorElement*> found_detelem, int& found_detelems_num);
   StatusCode detectorElementSupportPath(const IDetectorElement* det_elem, std::string& path, const std::string& parent_path = "");
 };
-
-#endif  // GAUSSGEO_GAUSSGEO_H_
diff --git a/Sim/GaussKine/.gaudi_project_ignore b/Sim/GaussKine/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussKine/src/GenerationToSimulation.cpp b/Sim/GaussKine/src/GenerationToSimulation.cpp
index 13ea7881f4a7c820e884408ad8107e0876be1f36..cfcc9a29c27820998306ab4daf69a4ff968cac6d 100755
--- a/Sim/GaussKine/src/GenerationToSimulation.cpp
+++ b/Sim/GaussKine/src/GenerationToSimulation.cpp
@@ -3,12 +3,12 @@
 #include "MCInterfaces/IFlagSignalChain.h"
 
 // Gaudi.
-#include "GaudiKernel/Vector3DTypes.h"
-#include "GaudiKernel/Transform4DTypes.h"
 #include "GaudiKernel/PhysicalConstants.h"
+#include "GaudiKernel/Transform4DTypes.h"
+#include "GaudiKernel/Vector3DTypes.h"
 
 // GiGa.
-#include "GiGa/IGiGaSvc.h" 
+#include "GiGa/IGiGaSvc.h"
 #include "GiGaCnv/GiGaPrimaryParticleInformation.h"
 
 // Event.
@@ -23,10 +23,10 @@
 #include "GenEvent/HepMCUtils.h"
 
 // Geant4.
-#include "Geant4/G4PrimaryVertex.hh"
-#include "Geant4/G4PrimaryParticle.hh"
-#include "Geant4/G4ParticleTable.hh"
 #include "Geant4/G4ParticlePropertyTable.hh"
+#include "Geant4/G4ParticleTable.hh"
+#include "Geant4/G4PrimaryParticle.hh"
+#include "Geant4/G4PrimaryVertex.hh"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : GenerationToSimulation
@@ -41,35 +41,36 @@ DECLARE_COMPONENT(GenerationToSimulation)
 // Standard constructor, declares properties.
 //=============================================================================
 GenerationToSimulation::GenerationToSimulation(const std::string& name,
-					       ISvcLocator* pSvcLocator) : 
-  GaudiAlgorithm(name, pSvcLocator), m_gigaSvc(0), m_particleContainer(0), 
-  m_vertexContainer(0), m_keepCuts(LoKi::Constant<const HepMC::GenParticle*, 
-				   bool>(true)) {
+                                               ISvcLocator* pSvcLocator)
+    : GaudiAlgorithm(name, pSvcLocator),
+      m_gigaSvc(0),
+      m_particleContainer(0),
+      m_vertexContainer(0),
+      m_keepCuts(LoKi::Constant<const HepMC::GenParticle*, bool>(true)) {
   declareProperty("GiGaService", m_gigaSvcName = "GiGa",
-		  "Name of the GiGa service.");
+                  "Name of the GiGa service.");
   declareProperty("HepMCEventLocation",
-		  m_generationLocation = LHCb::HepMCEventLocation::Default,
-		  "Location to read the HepMC event.");
+                  m_generationLocation = LHCb::HepMCEventLocation::Default,
+                  "Location to read the HepMC event.");
   declareProperty("Particles",
-		  m_particlesLocation = LHCb::MCParticleLocation::Default,
-		  "Location to place the MCParticles.");
+                  m_particlesLocation = LHCb::MCParticleLocation::Default,
+                  "Location to place the MCParticles.");
   declareProperty("Vertices",
-		  m_verticesLocation = LHCb::MCVertexLocation::Default,
-		  "Location to place the MCVertices.");  
+                  m_verticesLocation = LHCb::MCVertexLocation::Default,
+                  "Location to place the MCVertices.");
   declareProperty("TravelLimit", m_travelLimit = 1e-10 * CLHEP::m,
-		  "Pass particles to Geant4 with travel length above this.");
-  declareProperty("LookForUnknownParticles", 
-		  m_lookForUnknownParticles = false,
-		  "Check if Geant4 knows the particle type.");
+                  "Pass particles to Geant4 with travel length above this.");
+  declareProperty("LookForUnknownParticles", m_lookForUnknownParticles = false,
+                  "Check if Geant4 knows the particle type.");
   declareProperty("SkipGeant", m_skipGeant4 = false,
-		  "Skip passing everything to Geant4.");
-  declareProperty("UpdateG4ParticleProperties", 
-		  m_updateG4ParticleProperties = true,
-		  "Update the Geant4 particle properties.");
+                  "Skip passing everything to Geant4.");
+  declareProperty("UpdateG4ParticleProperties",
+                  m_updateG4ParticleProperties = true,
+                  "Update the Geant4 particle properties.");
   declareProperty("MCHeader", m_mcHeader = LHCb::MCHeaderLocation::Default,
-		  "Location to retrieve the MCHeader.");
-  declareProperty("KeepCode", m_keepCode = "", 
-		  "The code to flag additional particles for storage.");
+                  "Location to retrieve the MCHeader.");
+  declareProperty("KeepCode", m_keepCode = "",
+                  "The code to flag additional particles for storage.");
 }
 
 //=============================================================================
@@ -81,32 +82,30 @@ GenerationToSimulation::~GenerationToSimulation() {}
 // Initialization.
 //=============================================================================
 StatusCode GenerationToSimulation::initialize() {
-
   // Initialize the GaudiAlgorithm, return if failure.
-  StatusCode sc = GaudiAlgorithm::initialize(); 
+  StatusCode sc = GaudiAlgorithm::initialize();
   if (sc.isFailure()) return sc;
 
   // Intialize the tool.
   debug() << "==> Initialize" << endmsg;
   if (!m_skipGeant4) {
-    
     // Create the GiGa service.
     m_gigaSvc = svc<IGiGaSvc>(m_gigaSvcName, true);
-  
+
     // Update Geant4 particle properties from ParticlePropertySvc.
-    if (m_updateG4ParticleProperties) { 
-      LHCb::IParticlePropertySvc* ppSvc = 
-        svc<LHCb::IParticlePropertySvc>("LHCb::ParticlePropertySvc", true);
-      G4ParticlePropertyTable* PPT = G4ParticlePropertyTable::
-	GetParticlePropertyTable();
+    if (m_updateG4ParticleProperties) {
+      LHCb::IParticlePropertySvc* ppSvc =
+          svc<LHCb::IParticlePropertySvc>("LHCb::ParticlePropertySvc", true);
+      G4ParticlePropertyTable* PPT =
+          G4ParticlePropertyTable::GetParticlePropertyTable();
       G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
 
       // Suppress printing unknown PDGs from Gauss.
       if (!msgLevel(MSG::DEBUG)) particleTable->SetVerboseLevel(0);
       for (int i = 0; i < particleTable->size(); ++i) {
         G4ParticleDefinition* PDef = particleTable->GetParticle(i);
-        const LHCb::ParticleProperty* pp = ppSvc->
-	  find(LHCb::ParticleID(PDef->GetPDGEncoding()));
+        const LHCb::ParticleProperty* pp =
+            ppSvc->find(LHCb::ParticleID(PDef->GetPDGEncoding()));
         if (pp) {
           G4ParticlePropertyData* PPData = PPT->GetParticleProperty(PDef);
           PPData->SetPDGMass(pp->mass());
@@ -117,19 +116,19 @@ StatusCode GenerationToSimulation::initialize() {
       release(ppSvc);
     }
   }
-  
+
   // Cuts to keep additional particles.
   if (m_keepCode != "") {
     svc<IService>("LoKiSvc");
-    LoKi::IGenHybridFactory* factory = tool<LoKi::IGenHybridFactory>
-      ("LoKi::Hybrid::GenTool/GenFactory:PUBLIC", this);
+    LoKi::IGenHybridFactory* factory = tool<LoKi::IGenHybridFactory>(
+        "LoKi::Hybrid::GenTool/GenFactory:PUBLIC", this);
     sc = factory->get(m_keepCode, m_keepCuts);
-    if (sc.isFailure()) 
+    if (sc.isFailure())
       always() << "Error from KeepCode = '" + m_keepCode + "'" << endmsg;
   }
 
   // get tool to set signal flag
-  m_setSignalFlagTool = tool< IFlagSignalChain >( "FlagSignalChain" );
+  m_setSignalFlagTool = tool<IFlagSignalChain>("FlagSignalChain");
 
   return StatusCode::SUCCESS;
 }
@@ -138,27 +137,27 @@ StatusCode GenerationToSimulation::initialize() {
 // Main execution.
 //=============================================================================
 StatusCode GenerationToSimulation::execute() {
-  
   // Retrieve the HepMCEvents.
   debug() << "==> Execute" << endmsg;
-  LHCb::HepMCEvents* generationEvents = 
-    get<LHCb::HepMCEvents>(m_generationLocation);
+  LHCb::HepMCEvents* generationEvents =
+      get<LHCb::HepMCEvents>(m_generationLocation);
 
   // Create containers in TES for MCParticles and MCVertices.
   m_particleContainer = new LHCb::MCParticles();
   put(m_particleContainer, m_particlesLocation);
   m_vertexContainer = new LHCb::MCVertices();
   put(m_vertexContainer, m_verticesLocation);
-  if (!generationEvents || generationEvents->size() == 0)
-    {*gigaSvc() << NULL; return StatusCode::SUCCESS;}
+  if (!generationEvents || generationEvents->size() == 0) {
+    *gigaSvc() << NULL;
+    return StatusCode::SUCCESS;
+  }
 
   // Retrieve the MCHeader.
   LHCb::MCHeader* mcHeader = get<LHCb::MCHeader>(m_mcHeader);
 
   // Loop over the events (one for each pile-up interaction).
-  for(LHCb::HepMCEvents::const_iterator genEvent = generationEvents->begin(); 
+  for (LHCb::HepMCEvents::const_iterator genEvent = generationEvents->begin();
        generationEvents->end() != genEvent; ++genEvent) {
-
     // Retrieve the event.
     HepMC::GenEvent* ev = (*genEvent)->pGenEvt();
 
@@ -166,9 +165,13 @@ StatusCode GenerationToSimulation::execute() {
     m_g4ParticleMap.clear();
     m_mcParticleMap.clear();
     m_particlesToDelete.clear();
-    
+
     // Determine the position of the primary vertex.
     Gaudi::LorentzVector thePV = primaryVertex(ev);
+<<<<<<< HEAD
+=======
+
+>>>>>>> Ported GaussTracker
     /*
       Set G4PrimaryVertex to this position. The assumption is that all
       particles transferred to Geant4 for this pile up interaction
@@ -176,56 +179,62 @@ StatusCode GenerationToSimulation::execute() {
       with non zero lifetimes must be passed to Geant4 and then must
       be declared to Geant4 so that they can be transported correctly.
     */
-    G4PrimaryVertex* origVertex = 
-      new G4PrimaryVertex(thePV.X(), thePV.Y(), thePV.Z(), thePV.T());
+    G4PrimaryVertex* origVertex =
+        new G4PrimaryVertex(thePV.X(), thePV.Y(), thePV.Z(), thePV.T());
 
     // Create and add the primary MCVertex.
     LHCb::MCVertex* primaryVertex = new LHCb::MCVertex();
     m_vertexContainer->insert(primaryVertex);
-    primaryVertex->setPosition(Gaudi::XYZPoint( thePV.Vect()));
+    primaryVertex->setPosition(Gaudi::XYZPoint(thePV.Vect()));
     primaryVertex->setTime(thePV.T());
     primaryVertex->setType(LHCb::MCVertex::ppCollision);
     mcHeader->addToPrimaryVertices(primaryVertex);
-  
+
     // Set ID of all vertices to 0.
     for (HepMC::GenEvent::vertex_iterator itV = ev->vertices_begin();
-	 itV != ev->vertices_end(); ++itV) (*itV)->set_id(0);
+         itV != ev->vertices_end(); ++itV)
+      (*itV)->set_id(0);
 
     // Extract the particles to store in MCParticles.
     std::vector<HepMC::GenParticle*> mctruthList;
     for (HepMC::GenEvent::particle_const_iterator itP = ev->particles_begin();
-	 itP != ev->particles_end(); ++itP) {
-      if (keep(*itP) || (m_keepCode != "" && m_keepCuts(*itP))) { 
+         itP != ev->particles_end(); ++itP) {
+      if (keep(*itP) || (m_keepCode != "" && m_keepCuts(*itP))) {
         mctruthList.push_back(*itP);
-	
-	/*
+
+        /*
          Set the ID of of the end vertex to one, then the particle
          with production vertex of ID 0 and end vertex of ID 1 (or
          without end vertex) will be the start point of a decay tree
          to convert to MCTruth.
-	*/
+        */
         HepMC::GenVertex* endVertex = (*itP)->end_vertex();
         if (endVertex) endVertex->set_id(1);
       }
     }
-    
+
     // Sort the particles to be stored by barcode and then convert them.
-    std::sort(mctruthList.begin(), mctruthList.end(), 
-	      HepMCUtils::compareHepMCParticles);
+    std::sort(mctruthList.begin(), mctruthList.end(),
+              HepMCUtils::compareHepMCParticles);
     for (std::vector<HepMC::GenParticle*>::iterator it = mctruthList.begin();
-	 mctruthList.end() != it; ++it) {
+         mctruthList.end() != it; ++it) {
       HepMC::GenVertex* prodVertex = (*it)->production_vertex();
+<<<<<<< HEAD
       if (!prodVertex) 
         warning() << "The particle has no production vertex !!" <<endmsg;
+=======
+      if (!prodVertex)
+        warning() << "The particle has no production vertex !!" << endmsg;
+>>>>>>> Ported GaussTracker
       else if (0 == prodVertex->id())
         convert(*it, origVertex, primaryVertex, 0, 0);
     }
-    
+
     // Remove from the primary vertex and delete the unneeded particles.
     if (!m_particlesToDelete.empty()) {
-      std::vector< G4PrimaryParticle*>::const_iterator itDel;
-      for (itDel = m_particlesToDelete.begin(); 
-	   itDel != m_particlesToDelete.end(); ++itDel) { 
+      std::vector<G4PrimaryParticle*>::const_iterator itDel;
+      for (itDel = m_particlesToDelete.begin();
+           itDel != m_particlesToDelete.end(); ++itDel) {
         removeFromPrimaryVertex(origVertex, *itDel);
         delete *itDel;
       }
@@ -234,13 +243,14 @@ StatusCode GenerationToSimulation::execute() {
   }
 
   // This needs to be done only if Geant4 is not called since in that case
-  // the setting of the flags for the daughters is taken care of by 
+  // the setting of the flags for the daughters is taken care of by
   // SimulationToMCTruth
-  if ( m_skipGeant4 ) {
+  if (m_skipGeant4) {
     LHCb::MCParticles::const_iterator ip;
-    for ( ip = m_particleContainer->begin(); ip != m_particleContainer->end(); ip++ ) {
-      if ( (*ip)->fromSignal() ) {
-        m_setSignalFlagTool->setFromSignalFlag( *ip );
+    for (ip = m_particleContainer->begin(); ip != m_particleContainer->end();
+         ip++) {
+      if ((*ip)->fromSignal()) {
+        m_setSignalFlagTool->setFromSignalFlag(*ip);
       }
     }
   }
@@ -251,8 +261,9 @@ StatusCode GenerationToSimulation::execute() {
 //=============================================================================
 // Decides if a particle should be kept in MCParticles.
 //=============================================================================
-bool GenerationToSimulation::keep(const HepMC::GenParticle* particle) const{
+bool GenerationToSimulation::keep(const HepMC::GenParticle* particle) const {
   LHCb::ParticleID pid(particle->pdg_id());
+<<<<<<< HEAD
   switch (particle -> status()) {
   case LHCb::HepMCEvent::StableInProdGen: return true;
   case LHCb::HepMCEvent::DecayedByDecayGen: return true;
@@ -321,6 +332,109 @@ bool GenerationToSimulation::keep(const HepMC::GenParticle* particle) const{
     }
     return true;
   default: return false;
+=======
+  switch (particle->status()) {
+    case LHCb::HepMCEvent::StableInProdGen:
+      return true;
+    case LHCb::HepMCEvent::DecayedByDecayGen:
+      return true;
+    case LHCb::HepMCEvent::DecayedByDecayGenAndProducedByProdGen:
+      return true;
+    case LHCb::HepMCEvent::SignalInLabFrame:
+      return true;
+    case LHCb::HepMCEvent::StableInDecayGen:
+      return true;
+
+    // For some processes the resonance has status 3.
+    case LHCb::HepMCEvent::DocumentationParticle:
+      if (24 == particle->parent_event()->signal_process_id()) {
+        if (23 == pid.abspid())
+          return true;
+        else if (25 == pid.abspid())
+          return true;
+      } else if (26 == particle->parent_event()->signal_process_id()) {
+        if (24 == pid.abspid())
+          return true;
+        else if (25 == pid.abspid())
+          return true;
+      } else if (102 == particle->parent_event()->signal_process_id()) {
+        if (25 == pid.abspid()) return true;
+      } else if (6 == pid.abspid())
+        return true;
+      return false;
+    case LHCb::HepMCEvent::Unknown:
+      return false;
+    case LHCb::HepMCEvent::DecayedByProdGen:
+      if (pid.isHadron()) return true;
+      if (pid.isLepton()) return true;
+      if (pid.isNucleus()) return true;
+      if (pid.isDiQuark()) return false;
+
+      // Store particles of interest.
+      switch (pid.abspid()) {
+        case LHCb::ParticleID::down:
+          return false;
+        case LHCb::ParticleID::up:
+          return false;
+        case LHCb::ParticleID::strange:
+          return false;
+        case LHCb::ParticleID::charm:
+          return true;
+        case LHCb::ParticleID::bottom:
+          return true;
+        case LHCb::ParticleID::top:
+          return false;
+        case 21:
+          return false;  // Gluon.
+        case 22:
+          return true;  // Photon.
+        case 23:        // Z0.
+          if (24 == particle->parent_event()->signal_process_id())
+            return false;
+          else
+            return true;
+        case 24:  // W.
+          if (26 == particle->parent_event()->signal_process_id())
+            return false;
+          else
+            return true;
+        case 25:  // SM Higgs.
+          if (24 == particle->parent_event()->signal_process_id() ||
+              26 == particle->parent_event()->signal_process_id() ||
+              102 == particle->parent_event()->signal_process_id())
+            return false;
+          else
+            return true;
+        case 32:
+          return true;  // Z'.
+        case 33:
+          return true;  // Z''.
+        case 34:
+          return true;  // W'.
+        case 35:
+          return true;  // CP-even heavy Higgs (H0/H2).
+        case 36:
+          return true;  // CP-odd Higgs (A0/H3).
+        case 37:
+          return true;  // Charged Higgs (H+).
+        // See Table 6 of the Pythia 6 manual (arxiv.org/abs/hep-ph/0603175).
+        case 90:
+          return false;  // System particle.
+        case 91:
+          return false;  // Parton system from cluster fragmentation.
+        case 92:
+          return false;  // Parton system from string fragmentation.
+        case 93:
+          return false;  // Parton system from independent fragmentation.
+        case 94:
+          return false;  // Time-like showering system.
+        default:
+          return true;
+      }
+      return true;
+    default:
+      return false;
+>>>>>>> Ported GaussTracker
   }
   return false;
 }
@@ -328,100 +442,101 @@ bool GenerationToSimulation::keep(const HepMC::GenParticle* particle) const{
 //=============================================================================
 // Convert a decay tree into MCParticle or to G4PrimaryParticle.
 //=============================================================================
-void GenerationToSimulation::convert(HepMC::GenParticle*& particle, 
-				     G4PrimaryVertex* pvertexg4,
-				     LHCb::MCVertex* originVertex,
-				     G4PrimaryParticle* motherg4,
-				     LHCb::MCParticle* mothermcp) {
-
+void GenerationToSimulation::convert(HepMC::GenParticle*& particle,
+                                     G4PrimaryVertex* pvertexg4,
+                                     LHCb::MCVertex* originVertex,
+                                     G4PrimaryParticle* motherg4,
+                                     LHCb::MCParticle* mothermcp) {
   // Decision to convert the particle.
   unsigned char conversionCode = transferToGeant4(particle);
   switch (conversionCode) {
-  case 1: { // Convert particle to G4.
-
-    // Check if particle has been converted.
-    const int pBarcode = particle->barcode();
-    std::map<int, std::pair<bool, G4PrimaryParticle*> >::const_iterator 
-      result = m_g4ParticleMap.find(pBarcode);
-    if (result != m_g4ParticleMap.end()) {
-
-      // Return if converted.
-      if (result->second.first) return;
-
-      // Flag for deletion.
-      else {
-	m_g4ParticleMap.erase(pBarcode);
-	m_particlesToDelete.push_back(result->second.second);
+    case 1: {  // Convert particle to G4.
+
+      // Check if particle has been converted.
+      const int pBarcode = particle->barcode();
+      std::map<int, std::pair<bool, G4PrimaryParticle*>>::const_iterator
+          result = m_g4ParticleMap.find(pBarcode);
+      if (result != m_g4ParticleMap.end()) {
+        // Return if converted.
+        if (result->second.first) return;
+
+        // Flag for deletion.
+        else {
+          m_g4ParticleMap.erase(pBarcode);
+          m_particlesToDelete.push_back(result->second.second);
+        }
       }
+      G4PrimaryParticle* g4P = makeG4Particle(particle, mothermcp);
+
+      // Check mother.
+      if (!motherg4) {
+        // Flag for recreation with correct mother link.
+        if (!mothermcp)
+          m_g4ParticleMap.insert(
+              std::make_pair(pBarcode, std::make_pair(false, g4P)));
+        else
+          m_g4ParticleMap.insert(
+              std::make_pair(pBarcode, std::make_pair(true, g4P)));
+
+        // Attach root particle to G4 primary vertex.
+        if (pvertexg4)
+          pvertexg4->SetPrimary(g4P);
+        else
+          error() << "Primary vertex points to NULL !" << endmsg;
+
+        // Set mother link.
+      } else {
+        m_g4ParticleMap.insert(
+            std::make_pair(pBarcode, std::make_pair(true, g4P)));
+        motherg4->SetDaughter(g4P);
+      }
+      pvertexg4 = 0;
+      originVertex = 0;
+      motherg4 = g4P;
+      mothermcp = 0;
+      break;
     }
-    G4PrimaryParticle* g4P = makeG4Particle(particle, mothermcp);
-
-    // Check mother.
-    if (!motherg4) {
-
-      // Flag for recreation with correct mother link.
-      if (!mothermcp) m_g4ParticleMap.insert
-			(std::make_pair(pBarcode, std::make_pair(false, g4P)));
-      else m_g4ParticleMap.insert
-	     (std::make_pair(pBarcode, std::make_pair(true, g4P)));
-
-      // Attach root particle to G4 primary vertex.
-      if (pvertexg4) pvertexg4->SetPrimary(g4P);
-      else error() << "Primary vertex points to NULL !" << endmsg ;
-
-    // Set mother link.
-    } else {
-      m_g4ParticleMap.insert
-	(std::make_pair(pBarcode, std::make_pair(true, g4P)));
-      motherg4->SetDaughter(g4P);
-    }
-    pvertexg4 = 0;
-    originVertex = 0;
-    motherg4 = g4P;
-    mothermcp = 0; 
-    break;
-  }
-  case 2: { // Convert to MCParticle.
-
-    // Check if already converted.
-    const int pBarcode = particle->barcode() ;
-    std::map<int, bool>::const_iterator result = m_mcParticleMap.find(pBarcode);
-    if (result != m_mcParticleMap.end()) return;
-    
-    // Convert the particle.
-    LHCb::MCVertex* endVertex = 0 ;
-    LHCb::MCParticle* mcP = makeMCParticle(particle, endVertex);
-    if (originVertex) {
-      mcP->setOriginVertex(originVertex);
-      originVertex->addToProducts(mcP);
+    case 2: {  // Convert to MCParticle.
+
+      // Check if already converted.
+      const int pBarcode = particle->barcode();
+      std::map<int, bool>::const_iterator result =
+          m_mcParticleMap.find(pBarcode);
+      if (result != m_mcParticleMap.end()) return;
+
+      // Convert the particle.
+      LHCb::MCVertex* endVertex = 0;
+      LHCb::MCParticle* mcP = makeMCParticle(particle, endVertex);
+      if (originVertex) {
+        mcP->setOriginVertex(originVertex);
+        originVertex->addToProducts(mcP);
+      }
+      m_mcParticleMap.insert(std::make_pair(pBarcode, true));
+      mothermcp = mcP;
+      originVertex = endVertex;
+      break;
     }
-    m_mcParticleMap.insert(std::make_pair(pBarcode, true));
-    mothermcp = mcP;
-    originVertex = endVertex; 
-    break;
-  }
-  case 3: // Skip the particle.
-  default:
-    break;
+    case 3:  // Skip the particle.
+    default:
+      break;
   }
 
   // Convert all daughters of the HepMC particle (recurse).
   HepMC::GenVertex* ev = particle->end_vertex();
   if (ev) {
-
     // Create the list.
     std::vector<HepMC::GenParticle*> dList;
-    for (HepMC::GenVertex::particle_iterator itD = ev->particles_begin
-	   (HepMC::children); itD != ev->particles_end(HepMC::children); 
-	 ++itD) {
+    for (HepMC::GenVertex::particle_iterator itD =
+             ev->particles_begin(HepMC::children);
+         itD != ev->particles_end(HepMC::children); ++itD) {
       HepMC::GenParticle* P = (*itD);
       dList.push_back(P);
     }
-    
+
     // Sort by barcode and convert.
     std::sort(dList.begin(), dList.end(), HepMCUtils::compareHepMCParticles);
-    for (std::vector<HepMC::GenParticle*>::iterator itDD = dList.begin(); 
-	 dList.end() != itDD; ++itDD) {
+    for (std::vector<HepMC::GenParticle*>::iterator itDD = dList.begin();
+         dList.end() != itDD; ++itDD) {
       HepMC::GenParticle* P = (*itDD);
       convert(P, pvertexg4, originVertex, motherg4, mothermcp);
     }
@@ -434,19 +549,19 @@ void GenerationToSimulation::convert(HepMC::GenParticle*& particle,
 // 2: convert to MCParticle directly, the particle is not sent to Geant4.
 // 3: skip the particle completely.
 //=============================================================================
-unsigned char GenerationToSimulation::transferToGeant4
-(const HepMC::GenParticle* p) const {
+unsigned char GenerationToSimulation::transferToGeant4(
+    const HepMC::GenParticle* p) const {
   if (!(keep(p) || (m_keepCode != "" && m_keepCuts(p)))) return 3;
   if (m_skipGeant4) return 2;
 
   // Return for Geant4 tracking if stable.
   HepMC::GenVertex* ev = p->end_vertex();
-  if (!ev) { 
-    if (m_lookForUnknownParticles) 
-      if (!G4ParticleTable::GetParticleTable()->FindParticle(p->pdg_id())) 
-        warning() << "The particle " << p -> pdg_id() 
-		  << " is not known to Geant4 but travels a finite distance" 
-		  << endmsg;
+  if (!ev) {
+    if (m_lookForUnknownParticles)
+      if (!G4ParticleTable::GetParticleTable()->FindParticle(p->pdg_id()))
+        warning() << "The particle " << p->pdg_id()
+                  << " is not known to Geant4 but travels a finite distance"
+                  << endmsg;
     return 1;
   }
 
@@ -460,69 +575,67 @@ unsigned char GenerationToSimulation::transferToGeant4
   if (dist < m_travelLimit) return 2;
 
   // Return for Geant4 tracking if stable.
-  if (m_lookForUnknownParticles) 
-    if (!G4ParticleTable::GetParticleTable()->FindParticle(p->pdg_id())) 
-      warning() << "The particle " << p -> pdg_id() 
-		<< " is not known to Geant4 but travels a finite distance" 
-		<< endmsg;
+  if (m_lookForUnknownParticles)
+    if (!G4ParticleTable::GetParticleTable()->FindParticle(p->pdg_id()))
+      warning() << "The particle " << p->pdg_id()
+                << " is not known to Geant4 but travels a finite distance"
+                << endmsg;
   return 1;
 }
 
 //=============================================================================
 // Create a G4PrimaryParticle from a HepMC Particle.
 //=============================================================================
-G4PrimaryParticle* GenerationToSimulation::makeG4Particle
-(HepMC::GenParticle*& particle, LHCb::MCParticle* mcp) const {
-  HepMC::FourVector mom = particle -> momentum();
-  G4PrimaryParticle * g4P = new G4PrimaryParticle(particle->pdg_id(), mom.x(), 
-						  mom.y(), mom.z());
+G4PrimaryParticle* GenerationToSimulation::makeG4Particle(
+    HepMC::GenParticle*& particle, LHCb::MCParticle* mcp) const {
+  HepMC::FourVector mom = particle->momentum();
+  G4PrimaryParticle* g4P =
+      new G4PrimaryParticle(particle->pdg_id(), mom.x(), mom.y(), mom.z());
   g4P->SetMass(particle->generated_mass());
-  
+
   // Create information containing the HepMC link and signal information.
-  bool isSignalParticle(LHCb::HepMCEvent::SignalInLabFrame == 
-			(particle->status()));
-  GiGaPrimaryParticleInformation* gInfo = new GiGaPrimaryParticleInformation
-    (isSignalParticle, particle->barcode(), 0);
+  bool isSignalParticle(LHCb::HepMCEvent::SignalInLabFrame ==
+                        (particle->status()));
+  GiGaPrimaryParticleInformation* gInfo = new GiGaPrimaryParticleInformation(
+      isSignalParticle, particle->barcode(), 0);
 
   HepMC::GenVertex* ev = particle->end_vertex();
   if (ev) {
-    
     // Set propertime of the particle.
     double life = lifetime(mom, particle->production_vertex(), ev);
     g4P->SetProperTime(life);
-    
+
     // Store if particle has oscillated.
     const HepMC::GenParticle* B = hasOscillated(particle);
-    if (B) { 
+    if (B) {
       gInfo->setHasOscillated(true);
       particle = const_cast<HepMC::GenParticle*>(B);
     }
   }
-  
+
   // Link to MCParticle to be able to rebuild history later.
   if (mcp) gInfo->setMotherMCParticle(mcp);
   g4P->SetUserInformation(gInfo);
-  return g4P ;
+  return g4P;
 }
 
 //=============================================================================
 // Create an MCParticle from a HepMC GenParticle.
 //=============================================================================
-LHCb::MCParticle* GenerationToSimulation::makeMCParticle
-(HepMC::GenParticle*& particle, LHCb::MCVertex*& endVertex) const {
-
+LHCb::MCParticle* GenerationToSimulation::makeMCParticle(
+    HepMC::GenParticle*& particle, LHCb::MCVertex*& endVertex) const {
   // Create and insert into TES.
-  LHCb::MCParticle * mcp = new LHCb::MCParticle();
+  LHCb::MCParticle* mcp = new LHCb::MCParticle();
   m_particleContainer->insert(mcp);
 
   // Set properties.
   Gaudi::LorentzVector mom(particle->momentum());
   LHCb::ParticleID pid(particle->pdg_id());
-  mcp -> setMomentum(mom);
-  mcp -> setParticleID(pid);
-  
+  mcp->setMomentum(mom);
+  mcp->setParticleID(pid);
+
   // Set the vertex.
-  HepMC::GenVertex* V = particle->end_vertex() ;
+  HepMC::GenVertex* V = particle->end_vertex();
   if (V) {
     endVertex = new LHCb::MCVertex();
     m_vertexContainer->insert(endVertex);
@@ -533,19 +646,25 @@ LHCb::MCParticle* GenerationToSimulation::makeMCParticle
     // Check if the particle has oscillated.
     const HepMC::GenParticle* B = hasOscillated(particle);
     if (B) {
-      endVertex->setType( LHCb::MCVertex::OscillatedAndDecay);
+      endVertex->setType(LHCb::MCVertex::OscillatedAndDecay);
       particle = const_cast<HepMC::GenParticle*>(B);
-    } else if (( 4 == pid.abspid()) || (5 == pid.abspid()))
-      endVertex->setType( LHCb::MCVertex::StringFragmentation);
+    } else if ((4 == pid.abspid()) || (5 == pid.abspid()))
+      endVertex->setType(LHCb::MCVertex::StringFragmentation);
     else
-      endVertex -> setType( LHCb::MCVertex::DecayVertex);
-    mcp -> addToEndVertices(endVertex);
+      endVertex->setType(LHCb::MCVertex::DecayVertex);
+    mcp->addToEndVertices(endVertex);
   }
   
   //  Set the fromSignal flag
+<<<<<<< HEAD
   if ( LHCb::HepMCEvent::SignalInLabFrame == (particle->status())  ) {
       mcp -> setFromSignal(true);
     }
+=======
+  if (LHCb::HepMCEvent::SignalInLabFrame == (particle->status())) {
+    mcp->setFromSignal(true);
+  }
+>>>>>>> Ported GaussTracker
 
   //  Set the incoming parton flag
   // some more placeholders for status to be added
@@ -563,34 +682,40 @@ LHCb::MCParticle* GenerationToSimulation::makeMCParticle
 //=============================================================================
 // Determine the primary vertex for the event.
 //=============================================================================
-Gaudi::LorentzVector GenerationToSimulation::primaryVertex
-(const HepMC::GenEvent* genEvent) const {
+Gaudi::LorentzVector GenerationToSimulation::primaryVertex(
+    const HepMC::GenEvent* genEvent) const {
   Gaudi::LorentzVector result(0, 0, 0, 0);
 
   // First method, get the beam particle and use the decay vertex if it exists.
   if (genEvent->valid_beam_particles()) {
     HepMC::GenParticle* P = genEvent->beam_particles().first;
-    HepMC::GenVertex*   V = P->end_vertex();
-    if (V) result = V->position(); 
-    else error() << "The beam particles have no end vertex!" << endmsg;
-  // Second method, use the singal vertex stored in HepMC.
-  } else if ( 0 != genEvent -> signal_process_vertex() ) {
+    HepMC::GenVertex* V = P->end_vertex();
+    if (V)
+      result = V->position();
+    else
+      error() << "The beam particles have no end vertex!" << endmsg;
+    // Second method, use the singal vertex stored in HepMC.
+  } else if (0 != genEvent->signal_process_vertex()) {
     HepMC::GenVertex* V = genEvent->signal_process_vertex();
     result = V->position();
-  // Third method, take production/end vertex of the particle with barcode 1.
+    // Third method, take production/end vertex of the particle with barcode 1.
   } else {
     HepMC::GenParticle* P = genEvent->barcode_to_particle(1);
-    HepMC::GenVertex*   V = 0;
+    HepMC::GenVertex* V = 0;
     if (P) {
       V = P->production_vertex();
-      if (V) result = V->position();
+      if (V)
+        result = V->position();
       else {
         V = P->end_vertex();
-        if (V) result = V->position();
-        else error() << "The first particle has no production vertex and "
-		     << "no end vertex !" << endmsg ;
+        if (V)
+          result = V->position();
+        else
+          error() << "The first particle has no production vertex and "
+                  << "no end vertex !" << endmsg;
       }
-    } else error() << "No particle with barcode equal to 1!" << endmsg;
+    } else
+      error() << "No particle with barcode equal to 1!" << endmsg;
   }
   return result;
 }
@@ -598,9 +723,9 @@ Gaudi::LorentzVector GenerationToSimulation::primaryVertex
 //=============================================================================
 // Compute the lifetime of a particle.
 //=============================================================================
-double GenerationToSimulation::lifetime(const HepMC::FourVector mom, 
-					const HepMC::GenVertex* P,
-					const HepMC::GenVertex* E ) const {
+double GenerationToSimulation::lifetime(const HepMC::FourVector mom,
+                                        const HepMC::GenVertex* P,
+                                        const HepMC::GenVertex* E) const {
   if (!E) return 0;
   Gaudi::LorentzVector A(P->position()), B(E->position());
   Gaudi::LorentzVector AB = B - A;
@@ -612,7 +737,7 @@ double GenerationToSimulation::lifetime(const HepMC::FourVector mom,
   Gaudi::LorentzVector M(mom);
   ROOT::Math::Boost theBoost(M.BoostToCM());
   Gaudi::LorentzVector ABStar = theBoost(AB);
-  
+
   // Switch back to time.
   return ABStar.T() / Gaudi::Units::c_light;
 }
@@ -620,13 +745,13 @@ double GenerationToSimulation::lifetime(const HepMC::FourVector mom,
 //=============================================================================
 // Check if a particle has oscillated.
 //=============================================================================
-const HepMC::GenParticle* GenerationToSimulation::hasOscillated
-(const HepMC::GenParticle* P) const {
+const HepMC::GenParticle* GenerationToSimulation::hasOscillated(
+    const HepMC::GenParticle* P) const {
   const HepMC::GenVertex* ev = P->end_vertex();
-  if (!ev) return 0 ; 
+  if (!ev) return 0;
   if (1 != ev->particles_out_size()) return 0;
   const HepMC::GenParticle* D = *(ev->particles_out_const_begin());
-  if (!D) return 0 ;
+  if (!D) return 0;
   if (-P->pdg_id() != D->pdg_id()) return 0;
   return D;
 }
@@ -634,18 +759,18 @@ const HepMC::GenParticle* GenerationToSimulation::hasOscillated
 //=============================================================================
 // Remove a particle from a primary vertex.
 //=============================================================================
-void GenerationToSimulation::removeFromPrimaryVertex
-(G4PrimaryVertex*& pvertexg4, const G4PrimaryParticle* particleToDelete) const {
-
+void GenerationToSimulation::removeFromPrimaryVertex(
+    G4PrimaryVertex*& pvertexg4,
+    const G4PrimaryParticle* particleToDelete) const {
   // This should be rare, so warn.
-  warning() << "A G4PrimaryParticle will be removed from the G4PrimaryVertex" 
-	    << endmsg ;
+  warning() << "A G4PrimaryParticle will be removed from the G4PrimaryVertex"
+            << endmsg;
   particleToDelete->Print();
 
   // Make a new vertex.
-  G4PrimaryVertex* newVertex = new G4PrimaryVertex
-    (pvertexg4->GetX0(), pvertexg4->GetY0(),
-     pvertexg4->GetZ0(), pvertexg4->GetT0());
+  G4PrimaryVertex* newVertex =
+      new G4PrimaryVertex(pvertexg4->GetX0(), pvertexg4->GetY0(),
+                          pvertexg4->GetZ0(), pvertexg4->GetT0());
 
   // Copy particles to new vertex, except the one to remove.
   G4PrimaryParticle* particle = pvertexg4->GetPrimary();
diff --git a/Sim/GaussMonitor/.gaudi_project_ignore b/Sim/GaussMonitor/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussMonitor/src/GenMonitorAlg.cpp b/Sim/GaussMonitor/src/GenMonitorAlg.cpp
deleted file mode 100755
index 5e5f54f46385feb0095b6c7658a6fd698d112569..0000000000000000000000000000000000000000
--- a/Sim/GaussMonitor/src/GenMonitorAlg.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-// $Id: GenMonitorAlg.cpp,v 1.16 2010-02-24 19:02:33 robbep Exp $
-// Include files 
-
-// from Gaudi
-#include "GaudiKernel/SystemOfUnits.h"
-
-// From HepMC
-#include "Event/HepMCEvent.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenParticle.h"
-
-// From LHCb
-#include "Kernel/ParticleID.h"
-
-// local
-#include "GenMonitorAlg.h"
-#include "GaussGenUtil.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : GenMonitorAlg
-//
-// 2003-11-13 : Patrick Robbe
-// 2005-04-11 : G.Corti
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( GenMonitorAlg )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-GenMonitorAlg::GenMonitorAlg( const std::string& name,
-                              ISvcLocator* pSvcLocator)
-  : GaudiHistoAlg( name , pSvcLocator ) ,
-    m_counter       ( 0 ) ,
-    m_counterstable ( 0 ) ,
-    m_counterCharged( 0 ),
-    m_counterChInEta( 0 ),
-    m_nEvents       ( 0 ) {
-
-  declareProperty( "MinEta", m_minEta = 2.0);
-  declareProperty( "MaxEta", m_maxEta = 4.9);
-  declareProperty( "Input",  m_dataPath = LHCb::HepMCEventLocation::Default );
-  declareProperty( "ApplyTo", m_generatorName = "" );
-  
-  // Set by default not to fill histograms for this algorithm
-  setProduceHistos( false );
-  
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-GenMonitorAlg::~GenMonitorAlg() {}
-
-//=============================================================================
-// Initialisation. Check parameters
-//=============================================================================
-StatusCode GenMonitorAlg::initialize() {
-
-  StatusCode sc = GaudiHistoAlg::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiHistoAlg
-
-  debug() << "==> Initialize" << endmsg;
-  
-  if ( m_generatorName.empty() ) {
-    info() << "Monitor will be applied to all events in container " 
-           << m_dataPath << endmsg;
-  } else {
-    info() << "Monitor will be applied to events produced with generator "
-           << m_generatorName << " in container "
-           << m_dataPath << endmsg; 
-  }
-
-  if( produceHistos() ) {
-    bookHistos();
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode GenMonitorAlg::execute() {
-
-  debug() << "==> Execute" << endmsg;  
-
-  // Initialize counters
-  int nParticles(0), nParticlesStable(0);
-  int nParticlesStableCharged(0), nParChStabEtaAcc(0);
-  int nPileUp(0);
-  
-  // Retrieve data from selected path
-  SmartDataPtr< LHCb::HepMCEvents > hepMCptr( eventSvc() , m_dataPath );
-
-  if( 0 == hepMCptr ) {
-    info() << "No HepMCEvents at location " << m_dataPath << endmsg;
-  } else {
-    LHCb::HepMCEvents::iterator it ;
-    for( it = hepMCptr->begin() ; it != hepMCptr->end(); ++it ) {
-
-      // Check if monitor has to be applied to this event
-      if( !m_generatorName.empty() ) {
-        if( m_generatorName != (*it)->generatorName() ) {
-          continue;
-        }
-      }
-      debug() << "Monitor for " << (*it)->generatorName()
-              << endmsg;
-      
-      // Plot process type 
-      if( produceHistos() ) {
-        m_hProcess->fill( (*it)->pGenEvt()->signal_process_id() );
-      }
-
-      bool primFound = false;
-      nPileUp++;
-      for( HepMC::GenEvent::particle_const_iterator 
-             itp = (*it)->pGenEvt()->particles_begin();
-           itp != (*it)->pGenEvt()->particles_end(); itp++ ) {
-        HepMC::GenParticle* hepMCpart = *itp;
-        nParticles++ ;
-        if( produceHistos() ) { 
-          // Identify primary vertex and fill histograms
-          if( !primFound ) {
-            if( (hepMCpart->status() == 1) || (hepMCpart->status() == 888 ) ) {
-              primFound = true;
-              if ( hepMCpart -> production_vertex() ) {
-                m_hPrimX->fill( hepMCpart->production_vertex()->position().x()/
-                                Gaudi::Units::mm );
-                m_hPrimY->fill( hepMCpart->production_vertex()->position().y()/
-                                Gaudi::Units::mm );
-                m_hPrimZ->fill( hepMCpart->production_vertex()->position().z()/
-                                Gaudi::Units::mm );
-                m_hPrimZV->fill( hepMCpart->production_vertex()->position().z()/
-                                 Gaudi::Units::mm );
-                m_hPrimZE->fill( hepMCpart->production_vertex()->position().z()/
-                                 Gaudi::Units::mm );
-                m_hPrimT->fill( hepMCpart->production_vertex()->position().t()/
-                                Gaudi::Units::ns );
-                m_hPrimXvsZ->fill( hepMCpart->production_vertex()->position().z()/Gaudi::Units::mm,
-                                   hepMCpart->production_vertex()->position().x()/Gaudi::Units::mm );                
-                m_hPrimYvsZ->fill( hepMCpart->production_vertex()->position().z()/Gaudi::Units::mm,
-                                   hepMCpart->production_vertex()->position().y()/Gaudi::Units::mm );                
-              }
-            } 
-          }
-          
-          m_hPartP->fill( hepMCpart->momentum().rho()/
-                          Gaudi::Units::GeV );
-          m_hPartPDG->fill( hepMCpart->pdg_id() );
-        }
-        // Note that the following is really multiplicity of particle defined
-        // as stable by Pythia just after hadronization: all particles known by
-        // EvtGen are defined stable for Pythia (it will count rho and pi0  
-        // and gamma all togheter as stable ...
-        if( ( hepMCpart->status() != 2 ) && ( hepMCpart->status() != 3 ) ) {
-          nParticlesStable++;
-          if( produceHistos() ) {
-            m_hProtoP->fill( hepMCpart->momentum().rho()/
-                             Gaudi::Units::GeV );
-            m_hProtoPDG->fill( hepMCpart->pdg_id() );
-            m_hProtoLTime->fill( GaussGenUtil::lifetime( hepMCpart )/
-                                 Gaudi::Units::mm );
-          }
-          // Charged stable particles meaning really stable after EvtGen
-          LHCb::ParticleID pID( hepMCpart->pdg_id() );
-          if( 0.0 != pID.threeCharge() ) {
-            // A stable particle does not have an outgoing vertex
-            if( !hepMCpart->end_vertex() ) {
-             // should be the same as the following  
-              //             if ( ( hepMCpart -> status() == 999 )  
-              ++nParticlesStableCharged;
-              double pseudoRap =  hepMCpart->momentum().pseudoRapidity();
-              // in LHCb acceptance
-              if( (pseudoRap > m_minEta) && (pseudoRap < m_maxEta) ) {
-                ++nParChStabEtaAcc;
-              }
-              if( produceHistos() ) {
-                m_hStableEta->fill( pseudoRap );
-                m_hStablePt->fill( hepMCpart->momentum().perp()/
-                                   Gaudi::Units::GeV );
-              }
-            }
-          }    
-        }
-      }
-    }
-  }
-  if( produceHistos() ) {
-    m_hNPart->fill( nParticles );
-    m_hNStable->fill( nParticlesStable );
-    m_hNSCharg->fill( nParticlesStableCharged );
-    m_hNSChEta->fill( nParChStabEtaAcc );
-    m_hNPileUp->fill( nPileUp );
-  }
-  m_counter += nParticles ;
-  m_counterstable += nParticlesStable ;
-  m_counterCharged += nParticlesStableCharged;
-  m_counterChInEta += nParChStabEtaAcc;
-  m_nEvents++ ;
-  
-  debug() << "Event number " << m_nEvents << " contains "
-          << nParticles << " particles" << endmsg;
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode GenMonitorAlg::finalize() {
-
-  debug() << "==> Finalize" << endmsg;
-  
-  info() << std::endl 
-         << "======================== Generators Statistics ====================" 
-         << std::endl
-         << "=                                                                 ="
-         << std::endl 
-         << "= Number of particles generated: " << m_counter 
-         << std::endl 
-         << "= Number of events: " << m_nEvents
-         << std::endl
-         << "= Mean multiplicity: " << m_counter / ( double ) m_nEvents
-         << std::endl 
-         << "=                                                                 ="
-         << std::endl 
-         << "= Number of pseudo stable particles generated: " << m_counterstable
-         << std::endl 
-         << "= Number of events: " << m_nEvents
-         << std::endl
-         << "= Mean pseudo stable multiplicity: " 
-         << m_counterstable / ( double ) m_nEvents
-         << std::endl 
-         << "=                                                                 ="
-         << std::endl 
-         << "= Number of charged stable particles generated: " << m_counterCharged
-         << std::endl 
-         << "= Number of events: " << m_nEvents
-         << std::endl
-         << "= Mean charged stable multiplicity: " 
-         << m_counterCharged / ( double ) m_nEvents
-         << std::endl 
-         << "=                                                                 ="
-         << std::endl 
-         << "= Number of charged stable particles in LHCb eta " << m_counterChInEta
-         << std::endl 
-         << "= Number of events: " << m_nEvents
-         << std::endl
-         << "= Mean charged stable multiplicity in LHCb eta: " 
-         << m_counterChInEta / ( double ) m_nEvents
-         << std::endl 
-         << "=                                                                 ="
-         << std::endl 
-         << "==================================================================="
-         << endmsg;
-
-  return GaudiHistoAlg::finalize();
-  
-}
-
-//============================================================================
-// Booking of histograms
-//============================================================================
-void GenMonitorAlg::bookHistos() 
-{
-
-  debug() << "==> Book histograms" << endmsg;
- 
-  m_hNPart   = book(  1, "Multiplicity all particles", 0., 2999., 300 );
-  m_hNStable = book(  2, "Multiplicity protostable particles", 0., 2999., 300 );
-  m_hNSCharg = book(  3, "Multiplicity stable charged particles", -0.5, 299.5, 300 );
-  m_hNSChEta = book(  4, "Multiplicity stable charged particles in LHCb eta",
-                      -0.5, 299.5, 300 );
-  m_hProcess = book(  5, "Process type", -0.5, 5100.5, 5101);
-  m_hNPileUp = book( 10, "Num. of primary interaction per bunch", -0.5, 10.5, 11 );
-  m_hPrimX   = book( 11, "PrimaryVertex x (mm)", -1.0, 1.0, 200 );
-  m_hPrimY   = book( 12, "PrimaryVertex y (mm)", -1.0, 1.0, 200 );
-  m_hPrimZ   = book( 13, "PrimaryVertex z (mm)", -200., 200., 100 ); 
-  m_hPrimZV  = book( 14, "PrimaryVertex z, all Velo (mm)", -1000., 1000., 100 );
-  m_hPrimZE  = book( 15, "PrimaryVertex z, all Exp Area (mm)", -1000., 20000., 105 );
-  m_hPrimT   = book( 16, "PrimaryVertex t (ns)", -75.5, 75.5, 151 );
-  m_hPrimXvsZ = book2D( 17, "PrimaryVertex x vs z (mm)", -500., 500., 100, -1., 1., 100 );
-  m_hPrimYvsZ = book2D( 18, "PrimaryVertex y vs z (mm)", -500., 500., 100, -1., 1., 100 );
-  m_hPartP   = book( 21, "Momentum of all particles (GeV)", 0., 100., 100 );
-  m_hPartPDG = book( 22, "PDGid of all particles", -4999., 5000., 10000 );
-  m_hProtoP  = book( 31, "Momentum of protostable particles (GeV)", 0., 100., 100);
-  m_hProtoPDG = book( 32, "PDGid of protostable particles", -4999., 5000., 10000 );
-  m_hProtoLTime = book( 33, "Lifetime protostable particles (mm) ", -1., 20., 105 );
-  m_hStableEta = book( 44, "Pseudorapidity stable charged particles", -15., 15., 150 );
-  m_hStablePt  = book( 45, "Pt stable charged particles", 0., 20., 100 );
-
-  return;
-
-}
-
diff --git a/Sim/GaussMonitor/src/GenMonitorAlg.h b/Sim/GaussMonitor/src/GenMonitorAlg.h
deleted file mode 100755
index 9c9c8ad0a88cfea7d9e88ed44958af8435aa1cb4..0000000000000000000000000000000000000000
--- a/Sim/GaussMonitor/src/GenMonitorAlg.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// $Id: GenMonitorAlg.h,v 1.7 2009-12-17 19:29:19 gcorti Exp $
-#ifndef GAUSSMONITOR_GENMONITORALG_H
-#define GAUSSMONITOR_GENMONITORALG_H 1
-
-// Include files
-// from STL
-#include <string>
-
-// from Gaudi
-#include "GaudiAlg/GaudiHistoAlg.h"
-
-// from AIDA
-#include "AIDA/IHistogram1D.h"
-#include "AIDA/IHistogram2D.h"
-
-/** @class GenMonitorAlg GenMonitorAlg.h Algorithms/GenMonitorAlg.h
- *
- *  Monitoring algorithms for the generator sequences
- *
- *  @author Patrick Robbe (modified G.Corti)
- *  @date   2005-04-11
- */
-class GenMonitorAlg : public GaudiHistoAlg {
-public:
-  /// Standard constructor
-  GenMonitorAlg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~GenMonitorAlg( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
-
-protected:
-  void bookHistos();                  ///< Book histograms
-
-private:
-  std::string    m_dataPath;            ///< location of input data
-  double         m_minEta;              ///< Min pseudo rapidity acceptance
-  double         m_maxEta;              ///< Max pseudo rapidity acceptance
-
-  int            m_counter       , m_counterstable;
-  int            m_counterCharged, m_counterChInEta;
-  int            m_nEvents;
-
-  std::string    m_generatorName;
-
-  AIDA::IHistogram1D* m_hNPart;
-  AIDA::IHistogram1D* m_hNStable;
-  AIDA::IHistogram1D* m_hNSCharg;
-  AIDA::IHistogram1D* m_hNSChEta;
-  AIDA::IHistogram1D* m_hProcess;
-  AIDA::IHistogram1D* m_hNPileUp;
-  AIDA::IHistogram1D* m_hPrimX;
-  AIDA::IHistogram1D* m_hPrimY;
-  AIDA::IHistogram1D* m_hPrimZ;
-  AIDA::IHistogram1D* m_hPrimZV;
-  AIDA::IHistogram1D* m_hPrimZE;
-  AIDA::IHistogram1D* m_hPrimT;
-  AIDA::IHistogram1D* m_hPartP;
-  AIDA::IHistogram1D* m_hPartPDG;
-  AIDA::IHistogram1D* m_hProtoP;
-  AIDA::IHistogram1D* m_hProtoPDG;
-  AIDA::IHistogram1D* m_hProtoLTime;
-  AIDA::IHistogram1D* m_hStableEta;
-  AIDA::IHistogram1D* m_hStablePt;
-  AIDA::IHistogram2D* m_hPrimXvsZ;
-  AIDA::IHistogram2D* m_hPrimYvsZ;
-
-};
-#endif // GAUSSMONITOR_GENMONITORALG_H
diff --git a/Sim/GaussMonitor/src/MCTruthMonitor.cpp b/Sim/GaussMonitor/src/MCTruthMonitor.cpp
deleted file mode 100755
index 000a83f142ca35900ed7d2eeef57e71978662eaf..0000000000000000000000000000000000000000
--- a/Sim/GaussMonitor/src/MCTruthMonitor.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-// $Id: MCTruthMonitor.cpp,v 1.5 2009-03-26 21:45:04 robbep Exp $
-// Include files 
-
-// from Gaudi
-
-// from LHCb
-#include "Event/MCParticle.h"
-#include "Event/MCVertex.h"
-
-// local1
-#include "MCTruthMonitor.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : MCTruthMonitor
-//
-// 2005-08-12 : Gloria CORTI
-//-----------------------------------------------------------------------------
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( MCTruthMonitor )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-MCTruthMonitor::MCTruthMonitor( const std::string& name,
-                                ISvcLocator* pSvcLocator)
-  : GaudiHistoAlg ( name , pSvcLocator )
-{
-  declareProperty( "DetailedHistos", m_detailedHistos = false );  
-  declareProperty( "MCParticles"   , 
-                   m_mcParticles = LHCb::MCParticleLocation::Default ) ;
-  declareProperty( "MCVertices" , 
-                   m_mcVertices = LHCb::MCVertexLocation::Default ) ;
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-MCTruthMonitor::~MCTruthMonitor() {}
-
-//=============================================================================
-// Initialization
-//=============================================================================
-StatusCode MCTruthMonitor::initialize() {
-  StatusCode sc = GaudiHistoAlg::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-
-  debug() << "==> Initialize" << endmsg;
-
-  m_hNPart   = book(100, "Multiplicity MCparticles", 0., 1000., 100);
-  m_hNVert   = book(200, "Multiplicity MCVertices", 0., 200., 100);
-
-  m_hPOrigT   = book(101, "Vertex type of particles", 0., 20., 20);
-  m_hPOrigZ   = book(102, "Z origin of all particles (mm)", -1000., 20000., 2100);  
-  m_hPMom     = book(103, "Momentum of all particles (GeV)", 0., 1., 200);
-  m_hPPrimMom = book(104, "Momentum of primary particles (GeV)", 0., 100., 50);
-  m_hPProtMom = book(105, "Momentum of protons particles (GeV)", 0., 100., 50);
-
-  m_hVType   = book(201, "Vertex type", 0., 20., 20);
-  m_hVZpos   = book(202, "Z position of all vertices (mm)", -1000., 20000., 2100);
-  m_hVZpos2  = book(203, "Z position of all vertices (mm)", -10000., 10000., 200);
-  m_hVTime   = book(204, "Time of all vertices (ns)", -20., 100., 120);
-
-  if( !detailedHistos() ) {
-    return StatusCode::SUCCESS;
-  }
-
-  m_hNProtons   = book(111, "Number of protons", 0., 100., 50);
-  m_hNNeutrons  = book(112, "Number of neutrons", 0., 100., 50);
-  m_hNChPions   = book(113, "Number of charged pions", 0., 200., 100);
-  m_hNPiZeros   = book(114, "Number of pi zeros", 0., 200., 100);
-  m_hNChKaons   = book(115, "Number of charged kaons", 0., 50., 50);
-  m_hNKs        = book(116, "Number of Ks", 0., 50., 50);
-  m_hNElectrons = book(117, "Number of e+/e-", 0., 200., 100);
-  m_hNMuons     = book(118, "Number of mu+mu-", 0., 100., 100);
-  m_hNGammas    = book(119, "Number of gammas", 0., 200., 100);
-  m_hNBeauty    = book(120, "Number of particles with b/b~ quark", 0., 10., 10);
-  m_hNCharm     = book(121, "Number of particles with c/c~ quark", 0., 20., 20);
-  m_hNNuclei    = book(122, "Number of nuclei", 0., 50., 50);
-
-  return StatusCode::SUCCESS;
-}
- 
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode MCTruthMonitor::execute() {
-
-  debug() << "==> Execute" << endmsg;
-
-  unsigned int nProtons = 0, nNeutrons = 0, nChPions = 0, nPiZeros = 0;
-  unsigned int nChKaons = 0, nKs = 0, nElectrons = 0, nMuons = 0, nGammas = 0;
-  unsigned int nBeauty = 0, nCharm = 0, nNuclei = 0;
-
-  const LHCb::MCParticles* particles = 
-    get<LHCb::MCParticles>( m_mcParticles );
-  m_hNPart->fill(particles->size());
-  LHCb::MCParticles::const_iterator ip;
-  for( ip = particles->begin(); particles->end() != ip; ++ip ) {
-    m_hPOrigZ->fill((*ip)->originVertex()->position().z()/Gaudi::Units::mm);
-    int vtype = (*ip)->originVertex()->type();
-    if( vtype >=100 ) { vtype = vtype - 100 + 10; }
-    m_hPOrigT->fill(vtype);
-    m_hPMom->fill((*ip)->p()/Gaudi::Units::GeV);
-    if( (*ip)->originVertex()->type() == LHCb::MCVertex::ppCollision ) {
-      m_hPPrimMom->fill((*ip)->p()/Gaudi::Units::GeV);
-    }
-    LHCb::ParticleID id = (*ip)->particleID();
-    if( id.pid() == 2212 ) {
-      if( (*ip)->p() >= 5.0*Gaudi::Units::TeV ) {
-        m_hPProtMom->fill(10*((*ip)->p())/(Gaudi::Units::TeV/Gaudi::Units::GeV));
-      } else {
-        m_hPProtMom->fill((*ip)->p()/Gaudi::Units::GeV);
-      } 
-    }
-    if( detailedHistos() ) {
-      // Find number of different particles types
-      if( id.abspid() == 2212 ) nProtons++;
-      if( id.abspid() == 2112 ) nNeutrons++;
-      if( id.abspid() == 211 )  nChPions++;
-      if( id.abspid() == 111 )  nPiZeros++;
-      if( id.abspid() == 321 )  nChKaons++;
-      if( id.abspid() == 310 )  nKs++;
-      if( id.abspid() == 11 )   nElectrons++;
-      if( id.abspid() == 13 )   nMuons++;
-      if( id.abspid() == 22 )   nGammas++;
-      if( id.hasBottom() )      nBeauty++;
-      if( id.hasCharm() )       nCharm++;
-      if( id.isNucleus() )      nNuclei++;
-    }
-  }
-  if( detailedHistos() ) {
-    m_hNProtons->fill(nProtons);
-    m_hNNeutrons->fill(nNeutrons);
-    m_hNChPions->fill(nChPions);
-    m_hNPiZeros->fill(nPiZeros);
-    m_hNChKaons->fill(nChKaons);
-    m_hNKs->fill(nKs);
-    m_hNElectrons->fill(nElectrons);
-    m_hNMuons->fill(nMuons);
-    m_hNGammas->fill(nGammas);
-    m_hNBeauty->fill(nBeauty);
-    m_hNCharm->fill(nCharm);
-    m_hNNuclei->fill(nNuclei);
-  }
-  
-  const LHCb::MCVertices* vertices = 
-    get<LHCb::MCVertices>( m_mcVertices );
-  m_hNVert->fill(vertices->size());
-  LHCb::MCVertices::const_iterator iv;
-  for( iv = vertices->begin(); vertices->end()!= iv; ++iv ) {
-    int vtype = (*iv)->type();
-    if( vtype >=100 ) { vtype = vtype - 100 + 10; }
-    m_hVType->fill(vtype);
-    m_hVZpos->fill((*iv)->position().z()/Gaudi::Units::mm);
-    m_hVZpos2->fill((*iv)->position().z()/Gaudi::Units::mm);
-    m_hVTime->fill((*iv)->time()/Gaudi::Units::ns);
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode MCTruthMonitor::finalize() {
-
-  debug() << "==> Finalize" << endmsg;
-
-  return GaudiAlgorithm::finalize();  // must be called after all other actions
-}
-
-//=============================================================================
diff --git a/Sim/GaussMonitor/src/MCTruthMonitor.h b/Sim/GaussMonitor/src/MCTruthMonitor.h
deleted file mode 100755
index c5cf9963c0c78b4574dbe91460cd637f898aba1c..0000000000000000000000000000000000000000
--- a/Sim/GaussMonitor/src/MCTruthMonitor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// $Id: MCTruthMonitor.h,v 1.2 2009-03-26 21:45:04 robbep Exp $
-#ifndef MCTRUTHMONITOR_H
-#define MCTRUTHMONITOR_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiHistoAlg.h"
-
-// from AIDA
-#include "AIDA/IHistogram1D.h"
-
-/** @class MCTruthMonitor MCTruthMonitor.h
- *
- *  Algorithm to fill reference historgam for MCParticles and MCVertices.
- *  A more detailed set is switched on with property "DetailedHistos = true".
- *
- *  @author Gloria CORTI
- *  @date   2005-08-12
- */
-class MCTruthMonitor : public GaudiHistoAlg {
-public:
-  /// Standard constructor
-  MCTruthMonitor( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~MCTruthMonitor( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
-
-protected:
-  bool detailedHistos() {
-    return m_detailedHistos;
-  }
-
-private:
-
-  bool m_detailedHistos;             ///< Property to control set of histos
-  std::string m_mcParticles ;        ///< Location of the MCParticles
-  std::string m_mcVertices ;         ///< Location of the MCVertices
-  AIDA::IHistogram1D* m_hNPart;      ///< Histo of MCParticle multiplicity
-  AIDA::IHistogram1D* m_hNVert;      ///< Histo of MCVertices multiplicity
-  AIDA::IHistogram1D* m_hPOrigZ;     ///< Z Origin of all particles
-  AIDA::IHistogram1D* m_hPOrigT;     ///< Origin vertex type for all particles
-  AIDA::IHistogram1D* m_hPMom;       ///< |P| of all particles
-  AIDA::IHistogram1D* m_hPPrimMom;   ///< |P| of particles from primary vertex
-  AIDA::IHistogram1D* m_hPProtMom;   ///< |P| of protons
-  AIDA::IHistogram1D* m_hNProtons;   ///< p/p_bar multiplicity
-  AIDA::IHistogram1D* m_hNNeutrons;  ///< n/n_bar multiplicity
-  AIDA::IHistogram1D* m_hNChPions;   ///< pi+/- multiplicity
-  AIDA::IHistogram1D* m_hNPiZeros;   ///< pi0 multiplicity
-  AIDA::IHistogram1D* m_hNChKaons;   ///< K+/- multiplicity
-  AIDA::IHistogram1D* m_hNKs;        ///< Kshort multiplicity
-  AIDA::IHistogram1D* m_hNElectrons; ///< e+/- multiplicity
-  AIDA::IHistogram1D* m_hNMuons;     ///< mu+/- multiplicity
-  AIDA::IHistogram1D* m_hNGammas;    ///< gammas multiplicity
-  AIDA::IHistogram1D* m_hNBeauty;    ///< Particles with b/b_bar quark multip.
-  AIDA::IHistogram1D* m_hNCharm;     ///< Particles with c/c_bar quark multip.
-  AIDA::IHistogram1D* m_hNNuclei;    ///< nuclei multiplicity
-  AIDA::IHistogram1D* m_hVType;      ///< Type of all vertices
-  AIDA::IHistogram1D* m_hVZpos;      ///< Zpos of all vertices (in detector)
-  AIDA::IHistogram1D* m_hVZpos2;     ///< Zpos of all vertices (symm. in IP)
-  AIDA::IHistogram1D* m_hVTime;      ///< Time of all vertices
-
-};
-#endif // MCTRUTHMONITOR_H
diff --git a/Sim/GaussPhysics/CMakeLists.txt b/Sim/GaussPhysics/CMakeLists.txt
index 4eaec1d0058122be00483fa634410cb52a39e592..bb21fad59bc33cf1676b85877f1567f341afd36f 100644
--- a/Sim/GaussPhysics/CMakeLists.txt
+++ b/Sim/GaussPhysics/CMakeLists.txt
@@ -3,16 +3,27 @@
 ################################################################################
 gaudi_subdir(GaussPhysics v11r1p1)
 
-gaudi_depends_on_subdirs(Sim/GaussTools)
+gaudi_depends_on_subdirs(Sim/GiGaMTFactories
+                         Sim/GiGaMT
+                         Sim/GiGaMTCore
+                         LHCbG4PhysLists)
 
-FindG4libs(LHCblists physicslists)
+add_definitions(-DG4MULTITHREADED)
+add_definitions(-DG4USE_STD11)
 
 find_package(Boost)
 find_package(CLHEP)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS})
+AddHepMC3()
+FindG4libs(digits_hits event geometry global graphics_reps materials
+           particles processes run tracking track)
 
-gaudi_add_module(GaussPhysics
-                 src/*.cpp
-                 LINK_LIBRARIES GaussToolsLib
-                                ${GEANT4_LIBS})
+gaudi_add_module(GaussParticlesPhysics
+                 src/particles/*.cpp
+                 LINK_LIBRARIES GiGaMTCoreRunLib GaudiAlgLib GiGaMTLib G4LHCblists ${GEANT4_LIBS} CLHEP)
 
+
+gaudi_add_module(GaussCutPhysics
+                 src/cuts/*.cpp
+                 INCLUDE_DIRS GiGaMTFactories CLHEP Geant4
+                 LINK_LIBRARIES GaudiAlgLib CLHEP ${GEANT4_LIBS} GiGaMTCoreMessageLib)
diff --git a/Sim/GaussPhysics/src/GaussPhysics_factories.cpp b/Sim/GaussPhysics/src/GaussPhysics_factories.cpp
deleted file mode 100644
index 5b8b793ed29c61e0bafd3afb22337d7054e29cd3..0000000000000000000000000000000000000000
--- a/Sim/GaussPhysics/src/GaussPhysics_factories.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-// Include files 
-
-#include "GiGa/GiGaExtPhysics.h"
-
-
-/** @file 
- *  The mandatory file for declaration of component library entries 
- *  @author Witold Pokorsky
- *  @author Vanya Belyaev
- *  @author Gloria Corti, port to Gaudi v19
- *  @date 2002-09-26, last modified 2007-01-19
- */
-
-// Geant4 physics lists
-#include "Geant4/G4DecayPhysics.hh"
-
-// EM physics
-#include "Geant4/G4EmStandardPhysics_option1.hh"
-#include "Geant4/G4EmStandardPhysics_option2.hh"
-#include "Geant4/G4EmStandardPhysics_option3.hh"
-#include "Geant4/G4EmStandardPhysics.hh"
-#include "Geant4/G4EmExtraPhysics.hh"
-
-// LHCb Physics Lists
-#include "LHCbG4PhysLists/G4EmStandardPhysics_option1LHCb.h"
-#include "LHCbG4PhysLists/G4EmStandardPhysics_option1NoApplyCuts.h"
-#include "LHCbG4PhysLists/G4EmStandardPhysics_LHCbTest.h"
-
-// Ion and hadrons
-#include "Geant4/G4IonPhysics.hh"
-#include "Geant4/G4StoppingPhysics.hh"                // G4QStoppingPhysics.hh -> G4StoppingPhysics.hh in G4r10
-#include "Geant4/G4HadronElasticPhysics.hh"
-//#include "Geant4/G4HadronElasticPhysicsLHEP.hh"     // Removed from G4r10
-#include "Geant4/G4HadronElasticPhysicsHP.hh"
-#include "Geant4/G4NeutronTrackingCut.hh"
-
-// LHEP hadrons
-//#include "Geant4/HadronPhysicsLHEP.hh"              // Removed from G4r10
-
-// QGSP hadrons
-//#include "Geant4/G4HadronPhysicsQGSP.hh"            // Removed from G4r10
-#include "Geant4/G4HadronPhysicsQGSP_BERT.hh"
-#include "Geant4/G4HadronPhysicsQGSP_BERT_HP.hh"
-//#include "Geant4/G4HadronPhysicsQGSP_BERT_CHIPS.hh" // Removed from G4r10
-#include "Geant4/G4HadronPhysicsQGSP_FTFP_BERT.hh"
-
-// FTFP hadrons
-#include "Geant4/G4HadronPhysicsFTFP_BERT.hh"
-#include "Geant4/G4HadronPhysicsFTFP_BERT_HP.hh"
-
-
-// =========== Specialized extensions to GiGaExtPhysics ===========
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4EmStandardPhysics *newInstance(const std::string &name, int verbosity) const {
-    return new G4EmStandardPhysics(verbosity, name);
-  }
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_option1> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4EmStandardPhysics_option1 *newInstance(const std::string &name, int verbosity) const {
-    return new G4EmStandardPhysics_option1(verbosity, name);
-  }
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_option2> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4EmStandardPhysics_option2 *newInstance(const std::string &name, int verbosity) const {
-    return new G4EmStandardPhysics_option2(verbosity, name);
-  }
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_option3> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4EmStandardPhysics_option3 *newInstance(const std::string &name, int verbosity) const {
-    return new G4EmStandardPhysics_option3(verbosity, name);
-  }
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_option1NoApplyCuts> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4EmStandardPhysics_option1NoApplyCuts *newInstance(const std::string &name, int verbosity) const {
-    return new G4EmStandardPhysics_option1NoApplyCuts(verbosity, name);
-  }
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_option1LHCb> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("ApplyCuts", m_applyCuts = true, 
-                          "Apply production cuts to all EM processes for the LHCb EM constructor");
-    tool->declareProperty("NewModelForE", m_newForE = true,
-                          "Use new MS models for electrons and positrons");
-  }
-  inline G4EmStandardPhysics_option1LHCb *newInstance(const std::string &/*name*/, int verbosity) const {
-    return new G4EmStandardPhysics_option1LHCb(verbosity, m_applyCuts, m_newForE);
-  }
-private:
-  bool m_applyCuts;
-  bool m_newForE;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4EmStandardPhysics_LHCbTest> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("ApplyCuts", m_applyCuts = true, 
-                          "Apply production cuts to all EM processes for the LHCb EM constructor");
-    tool->declareProperty("NewModelForE", m_newForE = true,
-                          "Use new MS models for electrons and positrons");
-  }
-  inline G4EmStandardPhysics_LHCbTest *newInstance(const std::string &/*name*/, int verbosity) const {
-    return new G4EmStandardPhysics_LHCbTest(verbosity, m_applyCuts, m_newForE);
-  }
-private:
-  bool m_applyCuts;
-  bool m_newForE;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4DecayPhysics> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4DecayPhysics *newInstance(const std::string &name, int verbosity) const {
-    return new G4DecayPhysics(name, verbosity);
-  }
-};
-
-
-template <>
-class GiGaExtPhysicsExtender<G4StoppingPhysics> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("UseMuonMinusCapture", m_useMuonMinusCapture = true,
-                          "Parameter 'UseMuonMinusCapture' for the constructor of G4StoppingPhysics");
-  }
-  inline G4StoppingPhysics *newInstance(const std::string &name, int verbosity) const {
-    return new G4StoppingPhysics(name, verbosity, m_useMuonMinusCapture);
-  }
-private:
-  bool m_useMuonMinusCapture;
-};
-
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronElasticPhysics> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-  // no specialised properties
-    //    tool->declareProperty("HighPrecision", m_highPrecision = false,
-    //                          "Parameter 'HighPrecision' for the constructor of G4HadronElasticPhysics");
-    // tool->declareProperty("Glauber", m_glauber = false,
-    //                          "Parameter 'Glauber' for the constructor of G4HadronElasticPhysics");
-  }
-  inline G4HadronElasticPhysics *newInstance(const std::string &/*name*/, int verbosity) const {
-    //return new G4HadronElasticPhysics(name, verbosity, m_highPrecision, m_glauber);
-    return new G4HadronElasticPhysics(verbosity);
-  }
-//private:
-//  bool m_highPrecision;
-//  bool m_glauber;
-};
-
-// Removed in G4r10
-/*template <>
-class GiGaExtPhysicsExtender<G4HadronElasticPhysicsLHEP> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-  // No specific properties
-  }
-  inline G4HadronElasticPhysicsLHEP *newInstance(const std::string &name, int verbosity) const {
-    return new G4HadronElasticPhysicsLHEP(verbosity);
-  }
-};*/
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronElasticPhysicsHP> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-  // No specific properties
-  }
-  inline G4HadronElasticPhysicsHP *newInstance(const std::string &/*name*/, int verbosity) const {
-    return new G4HadronElasticPhysicsHP(verbosity);
-  }
-};
-
-// Removed in G4r10
-/*template <>
-class GiGaExtPhysicsExtender<HadronPhysicsQGSP> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = true,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsQGSP");
-  }
-  inline HadronPhysicsQGSP *newInstance(const std::string &name, int verbosity) const {
-    return new HadronPhysicsQGSP(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};*/
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronPhysicsQGSP_BERT> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = true,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsQGSP_BERT");
-  }
-  inline G4HadronPhysicsQGSP_BERT *newInstance(const std::string &name, int /*verbosity*/) const {
-    return new G4HadronPhysicsQGSP_BERT(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronPhysicsQGSP_BERT_HP> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = true,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsQGSP_BERT_HP");
-  }
-  inline G4HadronPhysicsQGSP_BERT_HP *newInstance(const std::string &name, int /*verbosity*/) const {
-    return new G4HadronPhysicsQGSP_BERT_HP(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};
-
-// Removed in G4r10
-/*template <>
-class GiGaExtPhysicsExtender<HadronPhysicsQGSP_BERT_CHIPS> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = true,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsQGSP_BERT_HP");
-  }
-  inline HadronPhysicsQGSP_BERT_CHIPS *newInstance(const std::string &name, int verbosity) const {
-    return new HadronPhysicsQGSP_BERT_CHIPS(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};*/
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronPhysicsQGSP_FTFP_BERT> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = true,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsQGSP_FTFP_BERT");
-  }
-  inline G4HadronPhysicsQGSP_FTFP_BERT *newInstance(const std::string &name, int /*verbosity*/) const {
-    return new G4HadronPhysicsQGSP_FTFP_BERT(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronPhysicsFTFP_BERT> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = false,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsFTFP_BERT");
-  }
-  inline G4HadronPhysicsFTFP_BERT *newInstance(const std::string &name, int /*verbosity*/) const {
-    return new G4HadronPhysicsFTFP_BERT(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4HadronPhysicsFTFP_BERT_HP> {
-public:
-  inline void addPropertiesTo(AlgTool *tool) {
-    tool->declareProperty("QuasiElastic", m_quasiElastic = false,
-                          "Parameter 'quasiElastic' for the constructor of HadronPhysicsFTFP_BERT_HP");
-  }
-  inline G4HadronPhysicsFTFP_BERT_HP *newInstance(const std::string &name, int /*verbosity*/) const {
-    return new G4HadronPhysicsFTFP_BERT_HP(name, m_quasiElastic);
-  }
-private:
-  bool m_quasiElastic;
-};
-
-template <>
-class GiGaExtPhysicsExtender<G4NeutronTrackingCut> {
-public:
-  inline void addPropertiesTo(AlgTool */*tool*/) {
-    // No specific properties
-  }
-  inline G4NeutronTrackingCut *newInstance(const std::string &name, int verbosity) const {
-    return new G4NeutronTrackingCut(name, verbosity);
-  }
-};
-
-typedef GiGaExtPhysics< G4EmStandardPhysics_option1 > EmStdOpt1PhysFactory;
-DECLARE_COMPONENT( EmStdOpt1PhysFactory )
-typedef GiGaExtPhysics< G4EmStandardPhysics_option2 > EmStdOpt2PhysFactory;
-DECLARE_COMPONENT( EmStdOpt2PhysFactory )
-typedef GiGaExtPhysics< G4EmStandardPhysics_option3 > EmStdOpt3PhysFactory;
-DECLARE_COMPONENT( EmStdOpt3PhysFactory )
-typedef GiGaExtPhysics< G4EmStandardPhysics > EmStdPhysFactory;
-DECLARE_COMPONENT( EmStdPhysFactory )
-typedef GiGaExtPhysics< G4DecayPhysics > DecayFactory;
-DECLARE_COMPONENT( DecayFactory )
-
-typedef GiGaExtPhysics< G4EmStandardPhysics_option1LHCb > EmStdLHCbPhysFactory;
-DECLARE_COMPONENT( EmStdLHCbPhysFactory )
-typedef GiGaExtPhysics< G4EmStandardPhysics_option1NoApplyCuts > EmStdOpt1NoCutsPhysFactory;
-DECLARE_COMPONENT( EmStdOpt1NoCutsPhysFactory )
-typedef GiGaExtPhysics< G4EmStandardPhysics_LHCbTest > EmStdLHCbTestPhysFactory;
-DECLARE_COMPONENT( EmStdLHCbTestPhysFactory )
-
-typedef GiGaExtPhysics< G4EmExtraPhysics > EmExtraPhysFactory;
-DECLARE_COMPONENT( EmExtraPhysFactory )
-
-typedef GiGaExtPhysics< G4IonPhysics > IonPhysFactory;
-DECLARE_COMPONENT( IonPhysFactory )
-typedef GiGaExtPhysics< G4StoppingPhysics > StopPhysFactory;
-DECLARE_COMPONENT( StopPhysFactory )
-typedef GiGaExtPhysics< G4HadronElasticPhysics > HadElPhysFactory;
-DECLARE_COMPONENT( HadElPhysFactory )
-
-typedef GiGaExtPhysics< G4HadronElasticPhysicsHP > HadElHPPhysFactory;
-DECLARE_COMPONENT( HadElHPPhysFactory )
-
-typedef GiGaExtPhysics< G4NeutronTrackingCut > NeuTrkCutFactory;
-DECLARE_COMPONENT( NeuTrkCutFactory )
-
-typedef GiGaExtPhysics< G4HadronPhysicsQGSP_BERT > HadPhysQGSP_BERTFactory;
-DECLARE_COMPONENT( HadPhysQGSP_BERTFactory )
-typedef GiGaExtPhysics< G4HadronPhysicsQGSP_BERT_HP > HadPhysQGSP_BERT_HPFactory;
-DECLARE_COMPONENT( HadPhysQGSP_BERT_HPFactory )
-
-typedef GiGaExtPhysics< G4HadronPhysicsQGSP_FTFP_BERT > HadPhysQGSP_FTFP_BERTFactory;
-DECLARE_COMPONENT( HadPhysQGSP_FTFP_BERTFactory )
-
-typedef GiGaExtPhysics< G4HadronPhysicsFTFP_BERT > HadPhysFTFP_BERTFactory;
-DECLARE_COMPONENT( HadPhysFTFP_BERTFactory )
-
-typedef GiGaExtPhysics< G4HadronPhysicsFTFP_BERT_HP > HadPhysFTFP_BERT_HPFactory;
-DECLARE_COMPONENT( HadPhysFTFP_BERT_HPFactory )
-
diff --git a/Sim/GaussPhysics/src/GiGaHiggsParticles.cpp b/Sim/GaussPhysics/src/GiGaHiggsParticles.cpp
deleted file mode 100755
index b57cbb8ca5dd593de2c8abfc47926cdeab939816..0000000000000000000000000000000000000000
--- a/Sim/GaussPhysics/src/GiGaHiggsParticles.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-// ============================================================================
-// Include files
-// STD & STL
-#include <algorithm>
-
-// GaudiKernel
-#include "GaudiKernel/PhysicalConstants.h"
-
-// LHCb
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-// GiGa
-#include "GiGa/GiGaPhysConstructorBase.h"
-// Geant4
-#include "Geant4/G4ParticleTable.hh"
-// Local
-#include "G4Higgses.h"
-
-// ============================================================================
-/** @class GiGaHiggsParticles
- *  simple class to construct Higgs particles
- *  (needed for Hidden Valley studies)
- *
- *  The major properties:
- *
- *    - "Higgses" : list of higgs particles to be created.
- *                  the default valeu contains [ "H_10" , "H_20" , "H_30" ]
- *
- *  It also prints (@ MSG::INFO) the properties of created higgses
- *
- *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
- *  @date 2008-06-22
- */
-class GiGaHiggsParticles : public GiGaPhysConstructorBase
-{
-public:
-  // ==========================================================================
-  /// constructor
-  GiGaHiggsParticles
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent )
-    : GiGaPhysConstructorBase ( type , name , parent )
-    , m_higgses ()
-  {
-    m_higgses.push_back ( "H_10" ) ;
-    m_higgses.push_back ( "H_20" ) ;
-    m_higgses.push_back ( "H_30" ) ;
-    declareProperty
-      ("Higgses" , m_higgses ,
-       "The List of Higgsed to be instantiated") ;
-  }
-  // ==========================================================================
-  /// construct the particles
-  void ConstructParticle ()    override; // construct the particles
-  /// construct the processed  (empty)
-  void ConstructProcess  () override {} ; // construct the processed
-  // ==========================================================================
-protected:
-  // ==========================================================================
-  /// get the particle property for the given particle name
-  const LHCb::ParticleProperty* pp
-  ( const std::string&    n ,
-    LHCb::IParticlePropertySvc* s ) const
-  {
-    Assert ( 0 != s , "Invalid ParticleProperty Service") ;
-    const LHCb::ParticleProperty* p = s->find ( n ) ;
-    Assert ( 0 != p , "No information is availale for '" + n + "'") ;
-    return p ;
-  }
-  // ==========================================================================
-private:
-  // ==========================================================================
-  typedef std::vector<std::string> Strings ;
-  /// list of Higgses to be instantiated
-  Strings    m_higgses ; // list of Higgses to be instantiated
-  // ==========================================================================
-};
-
-// ============================================================================
-// construct the particles
-// ============================================================================
-void GiGaHiggsParticles::ConstructParticle () // construct the particles
-{
-
-  LHCb::IParticlePropertySvc* ppSvc =
-    svc<LHCb::IParticlePropertySvc> ("LHCb::ParticlePropertySvc") ;
-
-  Strings tmp = m_higgses ;
-  {
-    // ========================================================================
-    Strings::iterator it = std::find  ( tmp.begin() , tmp.end() , "H_10" ) ;
-    if ( tmp.end() != it )
-    {
-      const LHCb::ParticleProperty* h10 = pp ( "H_10" , ppSvc ) ;
-      G4H_10* h_10 = G4H_10::Create
-        ( h10 -> mass     () ,
-          h10 -> lifetime () * Gaudi::Units::c_light ) ;
-      Assert ( 0 != h_10 , "Unable to create H_10" ) ;
-      if ( msgLevel ( MSG::INFO )  ) { h_10->DumpTable () ; }
-      tmp.erase ( it ) ;
-    }
-    // ========================================================================
-    it = std::find  ( tmp.begin() , tmp.end() , "H_20" ) ;
-    if ( tmp.end() != it )
-    {
-      const LHCb::ParticleProperty* h20 = pp ( "H_20" , ppSvc ) ;
-      G4H_20* h_20 = G4H_20::Create
-        ( h20 -> mass     () ,
-          h20 -> lifetime () * Gaudi::Units::c_light ) ;
-      Assert ( 0 != h_20 , "Unable to create H_20" ) ;
-      if ( msgLevel ( MSG::INFO ) ) { h_20->DumpTable () ; }
-      tmp.erase ( it ) ;
-    }
-    // ========================================================================
-    it = std::find  ( tmp.begin() , tmp.end() , "H_30" ) ;
-    if ( tmp.end() != it )
-    {
-      const LHCb::ParticleProperty* h30 = pp ( "H_30" , ppSvc ) ;
-      G4H_30* h_30 = G4H_30::Create
-        ( h30 -> mass     () ,
-          h30 -> lifetime () * Gaudi::Units::c_light ) ;
-      Assert ( 0 != h_30 , "Unable to create H_30" ) ;
-      if ( msgLevel ( MSG::INFO ) ) { h_30->DumpTable () ; }
-      tmp.erase ( it ) ;
-    }
-    // ========================================================================
-    Assert ( tmp.empty() , "Unknown Higgses in the list!" ) ;
-    // ========================================================================
-  }
-}
-
-// ============================================================================
-/// Declaration of the Tool Factory
-DECLARE_COMPONENT( GiGaHiggsParticles )
-
-// The END
-// ============================================================================
diff --git a/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.cpp b/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.cpp
deleted file mode 100755
index 0be58c2d0e2e779ae1fea27aedc4afc6042da5df..0000000000000000000000000000000000000000
--- a/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// $Id: GiGaPhysUnknownParticles.cpp,v 1.6 2009-10-20 07:35:07 marcin Exp $
-// Include files
-
-// from Gaudi
-#include "GaudiKernel/PhysicalConstants.h"
-
-// G4
-#include "Geant4/G4UnknownParticle.hh"
-#include "Geant4/G4ProcessManager.hh"
-#include "Geant4/G4ParticleTable.hh"
-
-// local
-#include "G4BcMesonMinus.h"
-#include "G4BcMesonPlus.h"
-#include "G4AntiLambdabZero.h"
-#include "G4LambdabZero.h"
-#include "G4AntiXibZero.h"
-#include "G4XibZero.h"
-#include "G4XibMinus.h"
-#include "G4XibPlus.h"
-#include "G4OmegabMinus.h"
-#include "G4OmegabPlus.h"
-#include "G4AntiXiccStarMinus.h"
-#include "G4XiccStarPlus.h"
-#include "G4AntiXiccMinus.h"
-#include "G4XiccPlus.h"
-#include "G4AntiXibcMinus.h"
-#include "G4XibcPlus.h"
-#include "G4AntiXibcZero.h"
-#include "G4XibcZero.h"
-#include "G4AntiXiccMinusMinus.h"
-#include "G4XiccPlusPlus.h"
-#include "G4Neutralino.h"
-#include "G4Neutralino2.h"
-#include "G4CharginoMinus.h"
-#include "G4CharginoPlus.h"
-#include "G4HiddenValley.h"
-#include "G4AntiOmegaccMinus.h"
-#include "G4OmegaccPlus.h"
-#include "G4AntiOmegabcZero.h"
-#include "G4OmegabcZero.h"
-
-//
-#include "GiGaPhysUnknownParticles.h"
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : GiGaPhysUnknownParticles
-//-----------------------------------------------------------------------------
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( GiGaPhysUnknownParticles )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-GiGaPhysUnknownParticles::GiGaPhysUnknownParticles
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent )
-  : GiGaPhysConstructorBase( type , name , parent ) 
-{ }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-GiGaPhysUnknownParticles::~GiGaPhysUnknownParticles(){}
-
-//=============================================================================
-// ConstructParticle
-//=============================================================================
-void GiGaPhysUnknownParticles::ConstructParticle()
-{
-  G4BcMesonMinus::BcMesonMinusDefinition() ;
-  G4BcMesonPlus::BcMesonPlusDefinition() ;  
-  G4XibMinus::XibMinusDefinition() ;
-  G4XibPlus::XibPlusDefinition() ;  
-  G4OmegabMinus::OmegabMinusDefinition() ;
-  G4OmegabPlus::OmegabPlusDefinition() ;  
-  G4AntiLambdabZero::AntiLambdabZeroDefinition();
-  G4LambdabZero::LambdabZeroDefinition();
-  G4AntiXibZero::AntiXibZeroDefinition();
-  G4XibZero::XibZeroDefinition();
-  G4AntiXiccStarMinus::AntiXiccStarMinusDefinition();
-  G4XiccStarPlus::XiccStarPlusDefinition();
-  G4AntiXiccMinus::AntiXiccMinusDefinition();
-  G4XiccPlus::XiccPlusDefinition();
-  G4AntiXibcMinus::AntiXibcMinusDefinition();
-  G4XibcPlus::XibcPlusDefinition();
-  G4AntiXibcZero::AntiXibcZeroDefinition();
-  G4XibcZero::XibcZeroDefinition();
-  G4AntiXiccMinusMinus::AntiXiccMinusMinusDefinition();
-  G4XiccPlusPlus::XiccPlusPlusDefinition();
-  G4Neutralino::NeutralinoDefinition();
-  G4HiddenValley::HiddenValleyDefinition(); 
-  G4Neutralino2::Neutralino2Definition();
-  G4CharginoPlus::CharginoPlusDefinition();
-  G4CharginoMinus::CharginoMinusDefinition();
-  G4OmegaccPlus::OmegaccPlusDefinition(); 
-  G4AntiOmegaccMinus::AntiOmegaccMinusDefinition();
-  G4OmegabcZero::OmegabcZeroDefinition();
-  G4AntiOmegabcZero::AntiOmegabcZeroDefinition(); 
-
- 
-  G4UnknownParticle::UnknownParticleDefinition();  
-}
-
-//=============================================================================
-// ConstructProcess
-//=============================================================================
-void GiGaPhysUnknownParticles::ConstructProcess()
-{
-  auto theParticleIterator = GetParticleIterator();
-  theParticleIterator -> reset() ;
-  while ( (*theParticleIterator)() ) {
-    G4ParticleDefinition * particle = theParticleIterator -> value() ;
-    G4ProcessManager     * pmanager = particle -> GetProcessManager() ;
-//    if ( m_decayProcess.IsApplicable( *particle ) ) {
-//      debug() << "### Decays for " << particle -> GetParticleName() 
-//              << endmsg ;
-//      pmanager -> AddProcess( &m_decayProcess ) ;
-      // set ordering for PostStepDoIt and AtRestDoIt
-//      pmanager -> SetProcessOrdering( &m_decayProcess , idxPostStep ) ;
-//      pmanager -> SetProcessOrdering( &m_decayProcess , idxAtRest   ) ;
-//      pmanager -> DumpInfo() ;      
-//    }
-    if ( particle -> GetParticleName() == "unknown" ) {
-      pmanager -> AddProcess( &m_unknownDecay ) ;
-      pmanager -> SetProcessOrdering( &m_unknownDecay , idxPostStep ) ;
-      debug() << "### Unknown Decays for " << particle -> GetParticleName() 
-              << endmsg ;
-      if ( msgLevel( MSG::DEBUG) ) 
-        pmanager -> DumpInfo() ;
-    }
-  }
-}
-
-//=============================================================================
diff --git a/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.h b/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.h
deleted file mode 100755
index 91541edde67a4f7332deabda1adb42623d0b806e..0000000000000000000000000000000000000000
--- a/Sim/GaussPhysics/src/GiGaPhysUnknownParticles.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// ============================================================================
-#ifndef    GAUSSPHYS_GIGAPHYSUNKNOWNPARTICLES_H
-#define    GAUSSPHYS_GIGAPHYSUNKNOWNPARTICLES_H 1
-// ============================================================================
-// include files
-// ============================================================================
-// GiGa
-// ============================================================================
-#include "GiGa/GiGaPhysConstructorBase.h"
-#include "Geant4/G4Decay.hh"
-#include "Geant4/G4UnknownDecay.hh"
-// ============================================================================
-// forward declarations
-template <class TYPE> class GiGaFactory;
-
-class GiGaPhysUnknownParticles : public GiGaPhysConstructorBase
-{
-  /// friend factory for instantiation
-  friend class GiGaFactory<GiGaPhysUnknownParticles>;
-
-public:
-
-  GiGaPhysUnknownParticles
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  ~GiGaPhysUnknownParticles();
-
-
-public:
-  void ConstructParticle () override;
-  void ConstructProcess  () override;
-
-private:
-
-  G4Decay m_decayProcess ;
-  G4UnknownDecay m_unknownDecay ;
-
-};
-// ============================================================================
-
-
-// ============================================================================
-#endif   ///< GAUSSPHYS_GIGAPHYSUNKNOWNPARTICLES_H
-// ============================================================================
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Sim/GaussTools/src/Components/KillAtOriginCut.cpp b/Sim/GaussPhysics/src/cuts/KillAtOriginCut.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/KillAtOriginCut.cpp
rename to Sim/GaussPhysics/src/cuts/KillAtOriginCut.cpp
diff --git a/Sim/GaussTools/src/Components/KillAtOriginCut.h b/Sim/GaussPhysics/src/cuts/KillAtOriginCut.h
similarity index 100%
rename from Sim/GaussTools/src/Components/KillAtOriginCut.h
rename to Sim/GaussPhysics/src/cuts/KillAtOriginCut.h
diff --git a/Sim/GaussTools/src/Components/LoopCuts.cpp b/Sim/GaussPhysics/src/cuts/LoopCuts.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/LoopCuts.cpp
rename to Sim/GaussPhysics/src/cuts/LoopCuts.cpp
diff --git a/Sim/GaussTools/src/Components/LoopCuts.h b/Sim/GaussPhysics/src/cuts/LoopCuts.h
similarity index 100%
rename from Sim/GaussTools/src/Components/LoopCuts.h
rename to Sim/GaussPhysics/src/cuts/LoopCuts.h
diff --git a/Sim/GaussTools/src/Components/MinEkineCuts.cpp b/Sim/GaussPhysics/src/cuts/MinEkineCuts.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/MinEkineCuts.cpp
rename to Sim/GaussPhysics/src/cuts/MinEkineCuts.cpp
diff --git a/Sim/GaussTools/src/Components/MinEkineCuts.h b/Sim/GaussPhysics/src/cuts/MinEkineCuts.h
similarity index 100%
rename from Sim/GaussTools/src/Components/MinEkineCuts.h
rename to Sim/GaussPhysics/src/cuts/MinEkineCuts.h
diff --git a/Sim/GaussTools/src/Components/PingPongCut.cpp b/Sim/GaussPhysics/src/cuts/PingPongCut.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/PingPongCut.cpp
rename to Sim/GaussPhysics/src/cuts/PingPongCut.cpp
diff --git a/Sim/GaussTools/src/Components/PingPongCut.h b/Sim/GaussPhysics/src/cuts/PingPongCut.h
similarity index 100%
rename from Sim/GaussTools/src/Components/PingPongCut.h
rename to Sim/GaussPhysics/src/cuts/PingPongCut.h
diff --git a/Sim/GaussTools/src/Components/SpecialCuts.cpp b/Sim/GaussPhysics/src/cuts/SpecialCuts.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/SpecialCuts.cpp
rename to Sim/GaussPhysics/src/cuts/SpecialCuts.cpp
diff --git a/Sim/GaussTools/src/Components/SpecialCuts.h b/Sim/GaussPhysics/src/cuts/SpecialCuts.h
similarity index 100%
rename from Sim/GaussTools/src/Components/SpecialCuts.h
rename to Sim/GaussPhysics/src/cuts/SpecialCuts.h
diff --git a/Sim/GaussPhysics/src/cuts/TrCutsRunAction.cpp b/Sim/GaussPhysics/src/cuts/TrCutsRunAction.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..f75fbefc923c24ba31a680bf176f5199986720f0
--- /dev/null
+++ b/Sim/GaussPhysics/src/cuts/TrCutsRunAction.cpp
@@ -0,0 +1,185 @@
+// G4
+#include "Geant4/G4ParticleDefinition.hh"
+#include "Geant4/G4ParticleTable.hh"
+#include "Geant4/G4ProcessManager.hh"
+
+// local
+#include "KillAtOriginCut.h"
+#include "LoopCuts.h"
+#include "MinEkineCuts.h"
+#include "PingPongCut.h"
+#include "TrCutsRunAction.h"
+#include "WorldCuts.h"
+#include "ZeroStepsCut.h"
+
+void TrCutsRunAction::ConstructProcess() {
+
+  // Loop on particles that have been defined and attach process
+  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
+  if (!particleTable) {
+    error("G4ParticleTable points to NULL!; return! ");
+    return;
+  }
+
+  int ii, ptbSiz = particleTable->size();
+
+  for (ii = 0; ii < ptbSiz; ii++) {
+    G4ParticleDefinition* particle = particleTable->GetParticle(ii);
+
+    if (!particle) {
+      warning("G4ParticleDefinition* points to NULL, skip it");
+      continue;
+    }
+
+    std::string pname = particle->GetParticleName();
+
+    // Do not attach cuts processes to optical photons nor short lived
+    // particle as will disappear anyway for other reasons!!!
+    if ((pname != "opticalphoton") && (!particle->IsShortLived())) {
+      int particleCode = particle->GetPDGEncoding();
+
+      double acut;
+
+      if (abs(particleCode) == 11) {
+        acut = m_ecut;
+      } else if (particleCode == 22) {
+        acut = m_phcut;
+      } else if (abs(particleCode) == 13) {
+        acut = m_mcut;
+      } else if (abs(particleCode) == 2112) {
+        acut = m_ncut;
+      } else if (abs(particleCode) == 12 || abs(particleCode) == 14 ||
+                 abs(particleCode) == 16) {
+        acut = m_nucut;
+      } else if ((abs(particleCode) == 2212) || (abs(particleCode) == 321) ||
+                 (abs(particleCode) == 211)) {
+        acut = m_pKpicut;
+      } else {
+        acut = m_ocut;
+      }
+
+      if ((pname != "opticalphoton") && (!particle->IsShortLived())) {
+        G4ProcessManager* procMgr = particle->GetProcessManager();
+        if (0 == procMgr) {
+          error("G4ProcessManager* points to NULL!");
+          return;
+        }
+
+        for (std::vector<int>::iterator ik = m_killAtOrigin.begin();
+             m_killAtOrigin.end() != ik; ik++) {
+          if (particleCode == *ik) {
+            procMgr->AddDiscreteProcess(
+                new GiGa::KillAtOriginCut("KillAtOriginCut"));
+          }
+        }  // closes loop on particles to kill
+
+        procMgr->AddDiscreteProcess(
+            new GiGa::MinEkineCuts("MinEkineCut", acut));
+        procMgr->AddDiscreteProcess(new GiGa::WorldCuts(
+            "WorldCut", m_minx, m_miny, m_minz, m_maxx, m_maxy, m_maxz));
+        if ((pname == "e-" || pname == "gamma") && m_killloops) {
+          procMgr->AddDiscreteProcess(
+              new GiGa::LoopCuts("LoopCuts", m_maxsteps, m_minstep));
+        }
+
+        if (m_killPingPong) {
+          procMgr->AddDiscreteProcess(
+              new GiGa::PingPongCut("PingPongCut", m_nMaxForPingPong,
+                                    m_stepLenghtPingPong, m_nMaxOfPingPong));
+        }
+        if (m_killZeroSteps) {
+          procMgr->AddDiscreteProcess(new GiGa::ZeroStepsCut(
+              "ZeroStepsCut", m_nStepsForZero, m_zeroMaxLenght, m_maxNZeroSteps,
+              m_world));
+        }
+      }
+    }
+  }
+}
+
+
+#include "GiGaMTFactories/GiGaFactoryBase.h"
+#include "GiGaMTFactories/GiGaTool.h"
+
+class TrCutsRunActionFAC
+    : public extends<GiGaTool, GiGaFactoryBase<G4VPhysicsConstructor>> {
+  public:
+  using extends::extends;
+  G4VPhysicsConstructor* construct() const override {
+    auto ret = new TrCutsRunAction{};
+    ret->SetMessageInterface(message_interface());
+    ret->m_ecut = m_ecut;
+    ret->m_phcut = m_phcut;
+    ret->m_pKpicut = m_pKpicut;
+    ret->m_ocut = m_ocut;
+    ret->m_ncut = m_ncut;
+    ret->m_nucut = m_nucut;
+    ret->m_mcut = m_mcut;
+    ret->m_killloops = m_killloops;
+    ret->m_maxsteps = m_maxsteps;
+    ret->m_minstep = m_minstep;
+    ret->m_minx = m_minx;
+    ret->m_miny = m_miny;
+    ret->m_minz = m_minz;
+    ret->m_maxx = m_maxx;
+    ret->m_maxy = m_maxy;
+    ret->m_maxz = m_maxz;
+    ret->m_killPingPong = m_killPingPong;
+    ret->m_nMaxForPingPong = m_nMaxForPingPong;
+    ret->m_nMaxOfPingPong = m_nMaxOfPingPong;
+    ret->m_stepLenghtPingPong = m_stepLenghtPingPong;
+    ret->m_killAtOrigin = m_killAtOrigin;
+    ret->m_killZeroSteps = m_killZeroSteps;
+    ret->m_nStepsForZero = m_nStepsForZero;
+    ret->m_zeroMaxLenght = m_zeroMaxLenght;
+    ret->m_maxNZeroSteps = m_maxNZeroSteps;
+    ret->m_world = m_world;
+    return ret;
+  }
+  Gaudi::Property<double> m_ecut{this, "ElectronTrCut", 1.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_phcut{this, "GammaTrCut", 1.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_pKpicut{this, "pKpiCut", 10.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_ncut{this, "NeutronTrCut", 10.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_nucut{this, "NeutrinoTrCut", 0.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_mcut{this, "MuonTrCut", 10.0 * CLHEP::MeV};
+  Gaudi::Property<double> m_ocut{this, "OtherTrCut", 0.0 * CLHEP::MeV};
+  Gaudi::Property<bool> m_killloops{this, "KillLoops", true};
+  Gaudi::Property<int> m_maxsteps{this, "MaxNumberSteps", 100};
+  Gaudi::Property<double> m_minstep{this, "MininumStep", 0.001};
+  Gaudi::Property<double> m_minx{this, "MinX", -10000 * CLHEP::mm};
+  Gaudi::Property<double> m_miny{this, "MinY", -5000 * CLHEP::mm};
+  Gaudi::Property<double> m_minz{this, "MinZ", -10000 * CLHEP::mm};
+  Gaudi::Property<double> m_maxx{this, "MaxX", 10000 * CLHEP::mm};
+  Gaudi::Property<double> m_maxy{this, "MaxY", 10000 * CLHEP::mm};
+  Gaudi::Property<double> m_maxz{this, "MaxZ", 25000 * CLHEP::mm};
+  Gaudi::Property<bool> m_killPingPong{this, "KillPingPong", true};
+  Gaudi::Property<int> m_nMaxForPingPong{this, "MaxNumStepsForPingPong",
+                                         1000000};
+  Gaudi::Property<int> m_nMaxOfPingPong{this, "MaxNumOfPingPong", 20};
+  Gaudi::Property<double> m_stepLenghtPingPong{this, "MaxStepLenForPingPong",
+                                               1.0e-3};
+  Gaudi::Property<std::vector<int>> m_killAtOrigin{
+      this,
+      "DoNotTrackParticles",
+      {12, 14, 16, -12, -14, -16},
+      "List of particles to discard at their origin"};
+  Gaudi::Property<bool> m_killZeroSteps{
+      this, "KillZeroSteps", true,
+      "Flag to activate killing particles that make step of zero "
+      "lenght in a volume"};
+  Gaudi::Property<int> m_nStepsForZero{
+      this, "NmaxForZeroSteps", 1000000,
+      "Number of steps after which to check for zero lenght steps"};
+  Gaudi::Property<double> m_zeroMaxLenght{
+      this, "StepLenghAsZero", 1.0e-9,
+      "Lenght of steps below which a steps has to be considered as "
+      "of zero lenght"};
+  Gaudi::Property<int> m_maxNZeroSteps{
+      this, "NZeroSteps", 20,
+      "Number of consecutive steps of zero lenght after which the "
+      "particle is killed"};
+  Gaudi::Property<std::string> m_world{this, "WorldName", "Universe",
+                                       "Name of the world volume"};
+};
+
+DECLARE_COMPONENT_WITH_ID( TrCutsRunActionFAC, "TrCutsRunAction" )
diff --git a/Sim/GaussPhysics/src/cuts/TrCutsRunAction.h b/Sim/GaussPhysics/src/cuts/TrCutsRunAction.h
new file mode 100755
index 0000000000000000000000000000000000000000..2ca7dfc642a71f124c181fa07b15207f7043e9e2
--- /dev/null
+++ b/Sim/GaussPhysics/src/cuts/TrCutsRunAction.h
@@ -0,0 +1,56 @@
+#pragma once
+#include "Geant4/G4VPhysicsConstructor.hh"
+#include "CLHEP/Units/SystemOfUnits.h"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
+#include <vector>
+
+
+/** @class TrCutsRunAction TrCutsRunAction.h
+ *
+ *  Class to pass Tracking Cuts to Geant4 as processes.
+ *  Modified to
+ *
+ *
+ *  @author Witek POKORSKI
+ *  @date   2003-04-10
+ *  @author Gloria CORTI
+ *  @date   2009-03-31
+ */
+
+class TrCutsRunActionFAC;
+
+class TrCutsRunAction: public G4VPhysicsConstructor, public GiGaMessage
+{
+  friend TrCutsRunActionFAC;
+
+public:
+
+  void ConstructParticle () override {};
+  void ConstructProcess  () override;
+
+  virtual ~TrCutsRunAction( ) = default;
+
+private:
+
+  double m_ecut{1.0*CLHEP::MeV}; ///< kinetic energy cut for e+/-
+  double m_phcut{1.0*CLHEP::MeV}; ///< kinetic energy cut for gamma
+  double m_pKpicut{10.0*CLHEP::MeV}; ///< kinetic energy cut for proton, K+/- and pi+/-
+  double m_ocut{0.0*CLHEP::MeV}; ///< kinetic energy cut for other particles
+  double m_ncut{10.0*CLHEP::MeV}; ///< kinetic energy cut for neutrons
+  double m_nucut{0.0*CLHEP::MeV}; ///< kinetic energy cut for neutrinos (when tracked)
+  double m_mcut{10.0*CLHEP::MeV}; ///< kinetic energy cut for muons
+  bool m_killloops{true}; ///< kill looping e- and gamma
+  int m_maxsteps{100}; ///< maximum number of step looping
+  double m_minstep{0.001}; ///< minimum lenght for looping cut
+  double m_minx{-10000*CLHEP::mm}, m_miny{-10000*CLHEP::mm}, m_minz{-5000*CLHEP::mm}, m_maxx{10000*CLHEP::mm}, m_maxy{10000*CLHEP::mm}, m_maxz{25000*CLHEP::mm}; ///< world cut limits
+  bool m_killPingPong{true}; ///< kill particles ping ponging
+  int m_nMaxForPingPong{1000000}; ///< maximum number of steps to check pingpong
+  int m_nMaxOfPingPong{20}; ///< maximum number of ping pong
+  double m_stepLenghtPingPong{1.0e-3}; ///< step lenght to consider in pingpong
+  std::vector<int> m_killAtOrigin{{12,14,16,-12,-14,-16}}; ///< particle to kill at origin (def=neutrino)
+  bool m_killZeroSteps{true}; ///< kill particle with 'zero' step
+  int m_nStepsForZero{1000000}; ///< number of steps after which to check for 'zero' steps
+  double m_zeroMaxLenght{1.0e-9}; ///< max lenght to consider a step of 'zero' lenght
+  int m_maxNZeroSteps{20}; ///< number of steps of zero length to trigger cut
+  std::string m_world{"Universe"}; ///< Name of world volume
+};
diff --git a/Sim/GaussTools/src/Components/WorldCuts.cpp b/Sim/GaussPhysics/src/cuts/WorldCuts.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/WorldCuts.cpp
rename to Sim/GaussPhysics/src/cuts/WorldCuts.cpp
diff --git a/Sim/GaussTools/src/Components/WorldCuts.h b/Sim/GaussPhysics/src/cuts/WorldCuts.h
similarity index 100%
rename from Sim/GaussTools/src/Components/WorldCuts.h
rename to Sim/GaussPhysics/src/cuts/WorldCuts.h
diff --git a/Sim/GaussTools/src/Components/ZeroStepsCut.cpp b/Sim/GaussPhysics/src/cuts/ZeroStepsCut.cpp
similarity index 100%
rename from Sim/GaussTools/src/Components/ZeroStepsCut.cpp
rename to Sim/GaussPhysics/src/cuts/ZeroStepsCut.cpp
diff --git a/Sim/GaussTools/src/Components/ZeroStepsCut.h b/Sim/GaussPhysics/src/cuts/ZeroStepsCut.h
similarity index 100%
rename from Sim/GaussTools/src/Components/ZeroStepsCut.h
rename to Sim/GaussPhysics/src/cuts/ZeroStepsCut.h
diff --git a/Sim/GaussPhysics/src/G4AntiLambdabZero.cpp b/Sim/GaussPhysics/src/particles/G4AntiLambdabZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiLambdabZero.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiLambdabZero.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiLambdabZero.h b/Sim/GaussPhysics/src/particles/G4AntiLambdabZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiLambdabZero.h
rename to Sim/GaussPhysics/src/particles/G4AntiLambdabZero.h
diff --git a/Sim/GaussPhysics/src/G4AntiOmegabcZero.cpp b/Sim/GaussPhysics/src/particles/G4AntiOmegabcZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiOmegabcZero.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiOmegabcZero.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiOmegabcZero.h b/Sim/GaussPhysics/src/particles/G4AntiOmegabcZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiOmegabcZero.h
rename to Sim/GaussPhysics/src/particles/G4AntiOmegabcZero.h
diff --git a/Sim/GaussPhysics/src/G4AntiOmegaccMinus.cpp b/Sim/GaussPhysics/src/particles/G4AntiOmegaccMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiOmegaccMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiOmegaccMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiOmegaccMinus.h b/Sim/GaussPhysics/src/particles/G4AntiOmegaccMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiOmegaccMinus.h
rename to Sim/GaussPhysics/src/particles/G4AntiOmegaccMinus.h
diff --git a/Sim/GaussPhysics/src/G4AntiXibZero.cpp b/Sim/GaussPhysics/src/particles/G4AntiXibZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibZero.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXibZero.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXibZero.h b/Sim/GaussPhysics/src/particles/G4AntiXibZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibZero.h
rename to Sim/GaussPhysics/src/particles/G4AntiXibZero.h
diff --git a/Sim/GaussPhysics/src/G4AntiXibcMinus.cpp b/Sim/GaussPhysics/src/particles/G4AntiXibcMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibcMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXibcMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXibcMinus.h b/Sim/GaussPhysics/src/particles/G4AntiXibcMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibcMinus.h
rename to Sim/GaussPhysics/src/particles/G4AntiXibcMinus.h
diff --git a/Sim/GaussPhysics/src/G4AntiXibcZero.cpp b/Sim/GaussPhysics/src/particles/G4AntiXibcZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibcZero.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXibcZero.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXibcZero.h b/Sim/GaussPhysics/src/particles/G4AntiXibcZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXibcZero.h
rename to Sim/GaussPhysics/src/particles/G4AntiXibcZero.h
diff --git a/Sim/GaussPhysics/src/G4AntiXiccMinus.cpp b/Sim/GaussPhysics/src/particles/G4AntiXiccMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXiccMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXiccMinus.h b/Sim/GaussPhysics/src/particles/G4AntiXiccMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccMinus.h
rename to Sim/GaussPhysics/src/particles/G4AntiXiccMinus.h
diff --git a/Sim/GaussPhysics/src/G4AntiXiccMinusMinus.cpp b/Sim/GaussPhysics/src/particles/G4AntiXiccMinusMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccMinusMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXiccMinusMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXiccMinusMinus.h b/Sim/GaussPhysics/src/particles/G4AntiXiccMinusMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccMinusMinus.h
rename to Sim/GaussPhysics/src/particles/G4AntiXiccMinusMinus.h
diff --git a/Sim/GaussPhysics/src/G4AntiXiccStarMinus.cpp b/Sim/GaussPhysics/src/particles/G4AntiXiccStarMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccStarMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4AntiXiccStarMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4AntiXiccStarMinus.h b/Sim/GaussPhysics/src/particles/G4AntiXiccStarMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4AntiXiccStarMinus.h
rename to Sim/GaussPhysics/src/particles/G4AntiXiccStarMinus.h
diff --git a/Sim/GaussPhysics/src/G4BcMesonMinus.cpp b/Sim/GaussPhysics/src/particles/G4BcMesonMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4BcMesonMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4BcMesonMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4BcMesonMinus.h b/Sim/GaussPhysics/src/particles/G4BcMesonMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4BcMesonMinus.h
rename to Sim/GaussPhysics/src/particles/G4BcMesonMinus.h
diff --git a/Sim/GaussPhysics/src/G4BcMesonPlus.cpp b/Sim/GaussPhysics/src/particles/G4BcMesonPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4BcMesonPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4BcMesonPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4BcMesonPlus.h b/Sim/GaussPhysics/src/particles/G4BcMesonPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4BcMesonPlus.h
rename to Sim/GaussPhysics/src/particles/G4BcMesonPlus.h
diff --git a/Sim/GaussPhysics/src/G4CharginoMinus.cpp b/Sim/GaussPhysics/src/particles/G4CharginoMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4CharginoMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4CharginoMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4CharginoMinus.h b/Sim/GaussPhysics/src/particles/G4CharginoMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4CharginoMinus.h
rename to Sim/GaussPhysics/src/particles/G4CharginoMinus.h
diff --git a/Sim/GaussPhysics/src/G4CharginoPlus.cpp b/Sim/GaussPhysics/src/particles/G4CharginoPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4CharginoPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4CharginoPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4CharginoPlus.h b/Sim/GaussPhysics/src/particles/G4CharginoPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4CharginoPlus.h
rename to Sim/GaussPhysics/src/particles/G4CharginoPlus.h
diff --git a/Sim/GaussPhysics/src/G4HiddenValley.cpp b/Sim/GaussPhysics/src/particles/G4HiddenValley.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4HiddenValley.cpp
rename to Sim/GaussPhysics/src/particles/G4HiddenValley.cpp
diff --git a/Sim/GaussPhysics/src/G4HiddenValley.h b/Sim/GaussPhysics/src/particles/G4HiddenValley.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4HiddenValley.h
rename to Sim/GaussPhysics/src/particles/G4HiddenValley.h
diff --git a/Sim/GaussPhysics/src/G4Higgses.cpp b/Sim/GaussPhysics/src/particles/G4Higgses.cpp
similarity index 99%
rename from Sim/GaussPhysics/src/G4Higgses.cpp
rename to Sim/GaussPhysics/src/particles/G4Higgses.cpp
index 5b9e49f84209325c73b408220ed214e63fce4f84..46b0bca5f46461e11dffa8ec44002ac87d08c48e 100755
--- a/Sim/GaussPhysics/src/G4Higgses.cpp
+++ b/Sim/GaussPhysics/src/particles/G4Higgses.cpp
@@ -9,7 +9,7 @@
 #include "GaudiKernel/PhysicalConstants.h"
 
 // GiGa
-#include "GiGa/GiGaException.h"
+#include "GiGaMT/GiGaException.h"
 
 // local
 #include "G4Higgses.h"
diff --git a/Sim/GaussPhysics/src/G4Higgses.h b/Sim/GaussPhysics/src/particles/G4Higgses.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4Higgses.h
rename to Sim/GaussPhysics/src/particles/G4Higgses.h
diff --git a/Sim/GaussPhysics/src/G4LambdabZero.cpp b/Sim/GaussPhysics/src/particles/G4LambdabZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4LambdabZero.cpp
rename to Sim/GaussPhysics/src/particles/G4LambdabZero.cpp
diff --git a/Sim/GaussPhysics/src/G4LambdabZero.h b/Sim/GaussPhysics/src/particles/G4LambdabZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4LambdabZero.h
rename to Sim/GaussPhysics/src/particles/G4LambdabZero.h
diff --git a/Sim/GaussPhysics/src/G4Neutralino.cpp b/Sim/GaussPhysics/src/particles/G4Neutralino.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4Neutralino.cpp
rename to Sim/GaussPhysics/src/particles/G4Neutralino.cpp
diff --git a/Sim/GaussPhysics/src/G4Neutralino.h b/Sim/GaussPhysics/src/particles/G4Neutralino.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4Neutralino.h
rename to Sim/GaussPhysics/src/particles/G4Neutralino.h
diff --git a/Sim/GaussPhysics/src/G4Neutralino2.cpp b/Sim/GaussPhysics/src/particles/G4Neutralino2.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4Neutralino2.cpp
rename to Sim/GaussPhysics/src/particles/G4Neutralino2.cpp
diff --git a/Sim/GaussPhysics/src/G4Neutralino2.h b/Sim/GaussPhysics/src/particles/G4Neutralino2.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4Neutralino2.h
rename to Sim/GaussPhysics/src/particles/G4Neutralino2.h
diff --git a/Sim/GaussPhysics/src/G4OmegabMinus.cpp b/Sim/GaussPhysics/src/particles/G4OmegabMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4OmegabMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4OmegabMinus.h b/Sim/GaussPhysics/src/particles/G4OmegabMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabMinus.h
rename to Sim/GaussPhysics/src/particles/G4OmegabMinus.h
diff --git a/Sim/GaussPhysics/src/G4OmegabPlus.cpp b/Sim/GaussPhysics/src/particles/G4OmegabPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4OmegabPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4OmegabPlus.h b/Sim/GaussPhysics/src/particles/G4OmegabPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabPlus.h
rename to Sim/GaussPhysics/src/particles/G4OmegabPlus.h
diff --git a/Sim/GaussPhysics/src/G4OmegabcZero.cpp b/Sim/GaussPhysics/src/particles/G4OmegabcZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabcZero.cpp
rename to Sim/GaussPhysics/src/particles/G4OmegabcZero.cpp
diff --git a/Sim/GaussPhysics/src/G4OmegabcZero.h b/Sim/GaussPhysics/src/particles/G4OmegabcZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegabcZero.h
rename to Sim/GaussPhysics/src/particles/G4OmegabcZero.h
diff --git a/Sim/GaussPhysics/src/G4OmegaccPlus.cpp b/Sim/GaussPhysics/src/particles/G4OmegaccPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegaccPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4OmegaccPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4OmegaccPlus.h b/Sim/GaussPhysics/src/particles/G4OmegaccPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4OmegaccPlus.h
rename to Sim/GaussPhysics/src/particles/G4OmegaccPlus.h
diff --git a/Sim/GaussPhysics/src/G4XibMinus.cpp b/Sim/GaussPhysics/src/particles/G4XibMinus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibMinus.cpp
rename to Sim/GaussPhysics/src/particles/G4XibMinus.cpp
diff --git a/Sim/GaussPhysics/src/G4XibMinus.h b/Sim/GaussPhysics/src/particles/G4XibMinus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibMinus.h
rename to Sim/GaussPhysics/src/particles/G4XibMinus.h
diff --git a/Sim/GaussPhysics/src/G4XibPlus.cpp b/Sim/GaussPhysics/src/particles/G4XibPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4XibPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4XibPlus.h b/Sim/GaussPhysics/src/particles/G4XibPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibPlus.h
rename to Sim/GaussPhysics/src/particles/G4XibPlus.h
diff --git a/Sim/GaussPhysics/src/G4XibZero.cpp b/Sim/GaussPhysics/src/particles/G4XibZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibZero.cpp
rename to Sim/GaussPhysics/src/particles/G4XibZero.cpp
diff --git a/Sim/GaussPhysics/src/G4XibZero.h b/Sim/GaussPhysics/src/particles/G4XibZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibZero.h
rename to Sim/GaussPhysics/src/particles/G4XibZero.h
diff --git a/Sim/GaussPhysics/src/G4XibcPlus.cpp b/Sim/GaussPhysics/src/particles/G4XibcPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibcPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4XibcPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4XibcPlus.h b/Sim/GaussPhysics/src/particles/G4XibcPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibcPlus.h
rename to Sim/GaussPhysics/src/particles/G4XibcPlus.h
diff --git a/Sim/GaussPhysics/src/G4XibcZero.cpp b/Sim/GaussPhysics/src/particles/G4XibcZero.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibcZero.cpp
rename to Sim/GaussPhysics/src/particles/G4XibcZero.cpp
diff --git a/Sim/GaussPhysics/src/G4XibcZero.h b/Sim/GaussPhysics/src/particles/G4XibcZero.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XibcZero.h
rename to Sim/GaussPhysics/src/particles/G4XibcZero.h
diff --git a/Sim/GaussPhysics/src/G4XiccPlus.cpp b/Sim/GaussPhysics/src/particles/G4XiccPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4XiccPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4XiccPlus.h b/Sim/GaussPhysics/src/particles/G4XiccPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccPlus.h
rename to Sim/GaussPhysics/src/particles/G4XiccPlus.h
diff --git a/Sim/GaussPhysics/src/G4XiccPlusPlus.cpp b/Sim/GaussPhysics/src/particles/G4XiccPlusPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccPlusPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4XiccPlusPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4XiccPlusPlus.h b/Sim/GaussPhysics/src/particles/G4XiccPlusPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccPlusPlus.h
rename to Sim/GaussPhysics/src/particles/G4XiccPlusPlus.h
diff --git a/Sim/GaussPhysics/src/G4XiccStarPlus.cpp b/Sim/GaussPhysics/src/particles/G4XiccStarPlus.cpp
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccStarPlus.cpp
rename to Sim/GaussPhysics/src/particles/G4XiccStarPlus.cpp
diff --git a/Sim/GaussPhysics/src/G4XiccStarPlus.h b/Sim/GaussPhysics/src/particles/G4XiccStarPlus.h
similarity index 100%
rename from Sim/GaussPhysics/src/G4XiccStarPlus.h
rename to Sim/GaussPhysics/src/particles/G4XiccStarPlus.h
diff --git a/Sim/GaussPhysics/src/particles/GaussPhysics_factories.cpp b/Sim/GaussPhysics/src/particles/GaussPhysics_factories.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..541e454b350b47b3d38345b96473b1d6cf875270
--- /dev/null
+++ b/Sim/GaussPhysics/src/particles/GaussPhysics_factories.cpp
@@ -0,0 +1,40 @@
+#include "GiGaMTFactories/GiGaMTG4PhysicsConstrFAC.h"
+
+// LHCb Physics Lists
+#include "LHCbG4PhysLists/G4EmStandardPhysics_LHCbTest.h"
+#include "LHCbG4PhysLists/G4EmStandardPhysics_option1LHCb.h"
+#include "LHCbG4PhysLists/G4EmStandardPhysics_option1NoApplyCuts.h"
+
+typedef GiGaMTG4PhysicsConstrFAC<G4EmStandardPhysics_option1NoApplyCuts> GiGaMT_G4EmStandardPhysics_option1NoApplyCuts;
+DECLARE_COMPONENT_WITH_ID(GiGaMT_G4EmStandardPhysics_option1NoApplyCuts, "GiGaMT_G4EmStandardPhysics_option1NoApplyCuts")
+
+template <typename PhysConstr>
+class GiGaMTG4PhysicsConstrFAC<
+    PhysConstr,
+    typename std::enable_if<
+        std::is_same<PhysConstr, G4EmStandardPhysics_option1LHCb>::value ||
+            std::is_same<PhysConstr, G4EmStandardPhysics_LHCbTest>::value,
+        PhysConstr>::type>
+    : public extends<GiGaMTPhysConstr, GiGaFactoryBase<G4VPhysicsConstructor>> {
+  Gaudi::Property<bool> m_applyCuts{
+      this, "ApplyCuts", true,
+      "Apply production cuts to all EM processes for the LHCb EM constructor"};
+  Gaudi::Property<bool> m_newForE{
+      this, "NewModelForE", true,
+      "Use new MS models for electrons and positrons"};
+
+  public:
+  using extends::extends;
+  PhysConstr* construct() const override {
+    auto tmp = new PhysConstr{verbosity(), m_applyCuts, m_newForE};
+    tmp->SetVerboseLevel(verbosity());
+    tmp->SetPhysicsName(name());
+    return tmp;
+  }
+};
+
+typedef GiGaMTG4PhysicsConstrFAC<G4EmStandardPhysics_option1LHCb> GiGaMT_G4EmStandardPhysics_option1LHCb;
+DECLARE_COMPONENT_WITH_ID(GiGaMT_G4EmStandardPhysics_option1LHCb, "GiGaMT_G4EmStandardPhysics_option1LHCb")
+
+typedef GiGaMTG4PhysicsConstrFAC<G4EmStandardPhysics_LHCbTest> GiGaMT_G4EmStandardPhysics_LHCbTest;
+DECLARE_COMPONENT_WITH_ID(GiGaMT_G4EmStandardPhysics_LHCbTest, "GiGaMT_G4EmStandardPhysics_LHCbTest")
diff --git a/Sim/GaussPhysics/src/particles/GiGaHiggsParticles.cpp b/Sim/GaussPhysics/src/particles/GiGaHiggsParticles.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..6551fbb99199e19185090f9e34065b72a879f156
--- /dev/null
+++ b/Sim/GaussPhysics/src/particles/GiGaHiggsParticles.cpp
@@ -0,0 +1,123 @@
+#include <algorithm>
+
+// GaudiKernel
+#include "GaudiKernel/PhysicalConstants.h"
+
+// LHCb
+#include "Kernel/IParticlePropertySvc.h"
+#include "Kernel/ParticleProperty.h"
+// Geant4
+#include "Geant4/G4ParticleTable.hh"
+#include "Geant4/G4VPhysicsConstructor.hh"
+// Local
+#include "G4Higgses.h"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
+#include "GiGaMTFactories/GiGaMTG4PhysicsConstrFAC.h"
+
+class GiGaMTHiggsParticles : public G4VPhysicsConstructor, public GiGaMessage
+{
+public:
+  GiGaMTHiggsParticles() = delete;
+  GiGaMTHiggsParticles
+  ( const LHCb::IParticlePropertySvc* ppsvc, std::vector<std::string> higgses): m_higgses(higgses), m_ppsvc(ppsvc)
+  {
+  }
+  void ConstructParticle ()    override; // construct the particles
+  void ConstructProcess  () override {} ; // construct the processed
+protected:
+  const LHCb::ParticleProperty* pp
+  ( const std::string&    n ,
+    const LHCb::IParticlePropertySvc* s ) const
+  {
+    if(!s){
+      throw std::runtime_error("Invalid ParticleProperty Service");
+    }
+    const LHCb::ParticleProperty* p = s->find ( n ) ;
+    if(!p){
+      throw std::runtime_error("No information is availale for '" + n + "'");
+    }
+    return p ;
+  }
+private:
+  std::vector<std::string> m_higgses{};
+  const LHCb::IParticlePropertySvc *m_ppsvc{nullptr};
+};
+
+void GiGaMTHiggsParticles::ConstructParticle () // construct the particles
+{
+
+  auto tmp = m_higgses ;
+  {
+    auto it = std::find  ( std::begin(tmp) , std::end(tmp) , "H_10" ) ;
+    if ( std::end(tmp) != it )
+    {
+      const LHCb::ParticleProperty* h10 = pp ( "H_10" , m_ppsvc) ;
+      G4H_10* h_10 = G4H_10::Create
+        ( h10 -> mass     () ,
+          h10 -> lifetime () * Gaudi::Units::c_light ) ;
+      if(!h_10){
+        throw std::runtime_error("Unable to create H_10");
+      }
+      if ( printInfo()  ) { h_10->DumpTable () ; }
+      tmp.erase ( it ) ;
+    }
+    // ========================================================================
+    it = std::find  ( std::begin(tmp) , std::end(tmp) , "H_20" ) ;
+    if ( std::end(tmp) != it )
+    {
+      const LHCb::ParticleProperty* h20 = pp ( "H_20" , m_ppsvc) ;
+      G4H_20* h_20 = G4H_20::Create
+        ( h20 -> mass     () ,
+          h20 -> lifetime () * Gaudi::Units::c_light ) ;
+      if(!h_20){
+        throw std::runtime_error("Unable to create H_20");
+      }
+      if ( printInfo()  ) { h_20->DumpTable () ; }
+      tmp.erase ( it ) ;
+    }
+    // ========================================================================
+    it = std::find  ( std::begin(tmp) , std::end(tmp) , "H_30" ) ;
+    if ( std::end(tmp) != it )
+    {
+      const LHCb::ParticleProperty* h30 = pp ( "H_30" , m_ppsvc) ;
+      G4H_30* h_30 = G4H_30::Create
+        ( h30 -> mass     () ,
+          h30 -> lifetime () * Gaudi::Units::c_light ) ;
+      if(!h_30){
+        throw std::runtime_error("Unable to create H_30");
+      }
+      if ( printInfo()  ) { h_30->DumpTable () ; }
+      tmp.erase ( it ) ;
+    }
+    if(!tmp.empty()){
+      throw std::runtime_error("Unknown Higgses in the list!");
+    }
+  }
+}
+
+
+template <typename PhysConstr>
+class GiGaMTG4PhysicsConstrFAC<
+    PhysConstr,
+    typename std::enable_if<
+        std::is_same<PhysConstr, GiGaMTHiggsParticles>::value,
+        PhysConstr>::type>
+    : public extends<GiGaMTPhysConstr, GiGaFactoryBase<G4VPhysicsConstructor>> {
+  Gaudi::Property<std::vector<std::string>> m_higgses{
+      this, "Higgses", {},
+      "The List of Higgsed to be instantiated"};
+  ServiceHandle<LHCb::IParticlePropertySvc> m_ppSvc{this, "PropertyService", "LHCb::ParticlePropertySvc"};
+
+  public:
+  using extends::extends;
+  PhysConstr* construct() const override {
+    auto tmp = new PhysConstr{m_ppSvc.get(), m_higgses};
+    tmp->SetMessageInterface(message_interface());
+    tmp->SetVerboseLevel(verbosity());
+    tmp->SetPhysicsName(name());
+    return tmp;
+  }
+};
+
+typedef GiGaMTG4PhysicsConstrFAC<GiGaMTHiggsParticles> GiGaMT_GiGaMTHiggsParticles;
+DECLARE_COMPONENT_WITH_ID(GiGaMT_GiGaMTHiggsParticles, "GiGaMTHiggsParticles")
diff --git a/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.cpp b/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..87b322c5f27995e49acb8f1b9d9a362d9d87761c
--- /dev/null
+++ b/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.cpp
@@ -0,0 +1,98 @@
+// from Gaudi
+#include "GaudiKernel/PhysicalConstants.h"
+
+// G4
+#include "Geant4/G4ParticleTable.hh"
+#include "Geant4/G4ProcessManager.hh"
+#include "Geant4/G4UnknownParticle.hh"
+
+// local
+#include "G4AntiLambdabZero.h"
+#include "G4AntiOmegabcZero.h"
+#include "G4AntiOmegaccMinus.h"
+#include "G4AntiXibZero.h"
+#include "G4AntiXibcMinus.h"
+#include "G4AntiXibcZero.h"
+#include "G4AntiXiccMinus.h"
+#include "G4AntiXiccMinusMinus.h"
+#include "G4AntiXiccStarMinus.h"
+#include "G4BcMesonMinus.h"
+#include "G4BcMesonPlus.h"
+#include "G4CharginoMinus.h"
+#include "G4CharginoPlus.h"
+#include "G4HiddenValley.h"
+#include "G4LambdabZero.h"
+#include "G4Neutralino.h"
+#include "G4Neutralino2.h"
+#include "G4OmegabMinus.h"
+#include "G4OmegabPlus.h"
+#include "G4OmegabcZero.h"
+#include "G4OmegaccPlus.h"
+#include "G4XibMinus.h"
+#include "G4XibPlus.h"
+#include "G4XibZero.h"
+#include "G4XibcPlus.h"
+#include "G4XibcZero.h"
+#include "G4XiccPlus.h"
+#include "G4XiccPlusPlus.h"
+#include "G4XiccStarPlus.h"
+
+//
+#include "GiGaPhysUnknownParticles.h"
+
+void GiGaMTPhysUnknownParticles::ConstructParticle() {
+  G4BcMesonMinus::BcMesonMinusDefinition();
+  G4BcMesonPlus::BcMesonPlusDefinition();
+  G4XibMinus::XibMinusDefinition();
+  G4XibPlus::XibPlusDefinition();
+  G4OmegabMinus::OmegabMinusDefinition();
+  G4OmegabPlus::OmegabPlusDefinition();
+  G4AntiLambdabZero::AntiLambdabZeroDefinition();
+  G4LambdabZero::LambdabZeroDefinition();
+  G4AntiXibZero::AntiXibZeroDefinition();
+  G4XibZero::XibZeroDefinition();
+  G4AntiXiccStarMinus::AntiXiccStarMinusDefinition();
+  G4XiccStarPlus::XiccStarPlusDefinition();
+  G4AntiXiccMinus::AntiXiccMinusDefinition();
+  G4XiccPlus::XiccPlusDefinition();
+  G4AntiXibcMinus::AntiXibcMinusDefinition();
+  G4XibcPlus::XibcPlusDefinition();
+  G4AntiXibcZero::AntiXibcZeroDefinition();
+  G4XibcZero::XibcZeroDefinition();
+  G4AntiXiccMinusMinus::AntiXiccMinusMinusDefinition();
+  G4XiccPlusPlus::XiccPlusPlusDefinition();
+  G4Neutralino::NeutralinoDefinition();
+  G4HiddenValley::HiddenValleyDefinition();
+  G4Neutralino2::Neutralino2Definition();
+  G4CharginoPlus::CharginoPlusDefinition();
+  G4CharginoMinus::CharginoMinusDefinition();
+  G4OmegaccPlus::OmegaccPlusDefinition();
+  G4AntiOmegaccMinus::AntiOmegaccMinusDefinition();
+  G4OmegabcZero::OmegabcZeroDefinition();
+  G4AntiOmegabcZero::AntiOmegabcZeroDefinition();
+
+  G4UnknownParticle::UnknownParticleDefinition();
+}
+
+void GiGaMTPhysUnknownParticles::ConstructProcess() {
+  auto theParticleIterator = GetParticleIterator();
+  theParticleIterator->reset();
+  while ((*theParticleIterator)()) {
+    G4ParticleDefinition* particle = theParticleIterator->value();
+    G4ProcessManager* pmanager = particle->GetProcessManager();
+    if (particle->GetParticleName() == "unknown") {
+      pmanager->AddProcess(&m_unknownDecay);
+      pmanager->SetProcessOrdering(&m_unknownDecay, idxPostStep);
+      if (printDebug()) {
+        std::stringstream message;
+        message << "### Unknown Decays for " << particle->GetParticleName();
+        debug(message.str());
+      }
+      if (printDebug()) pmanager->DumpInfo();
+    }
+  }
+}
+
+#include "GiGaMTFactories/GiGaMTG4PhysicsConstrFAC.h"
+typedef GiGaMTG4PhysicsConstrFAC<GiGaMTPhysUnknownParticles> GiGaMT_GiGaMTPhysUnknownParticles;
+DECLARE_COMPONENT_WITH_ID(GiGaMT_GiGaMTPhysUnknownParticles, "GiGaPhysUnknownParticles")
diff --git a/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.h b/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.h
new file mode 100755
index 0000000000000000000000000000000000000000..c5e2bb7e59ea66fb71984bf896444c5c0cbbe208
--- /dev/null
+++ b/Sim/GaussPhysics/src/particles/GiGaPhysUnknownParticles.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "Geant4/G4VPhysicsConstructor.hh"
+#include "Geant4/G4Decay.hh"
+#include "Geant4/G4UnknownDecay.hh"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
+
+class GiGaMTPhysUnknownParticles :public GiGaMessage, public G4VPhysicsConstructor
+{
+
+public:
+  void ConstructParticle () override;
+  void ConstructProcess  () override;
+
+private:
+
+  G4Decay m_decayProcess ;
+  G4UnknownDecay m_unknownDecay ;
+
+};
diff --git a/Sim/GaussRICH/.gaudi_project_ignore b/Sim/GaussRICH/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussRedecay/.gaudi_project_ignore b/Sim/GaussRedecay/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussTools/.gaudi_project_ignore b/Sim/GaussTools/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GaussTools/GaussTools/GaussTrackInformation.h b/Sim/GaussTools/GaussTools/GaussTrackInformation.h
deleted file mode 100755
index 18cd67ca2dabff216af29e170b3b3d157d622f50..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/GaussTools/GaussTrackInformation.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// ============================================================================
-#ifndef      GaussTools_GaussTrackInformation_H
-#define      GaussTools_GaussTrackInformation_H 1
-// ============================================================================
-/// STL
-#include <string>
-#include <vector>
-// GiGa
-#include "GiGa/GiGaUtil.h"
-/// Geant4
-#include "Geant4/G4VUserTrackInformation.hh"
-/// GaussTools
-#include "GaussTools/GaussHitBase.h"
-#include "GaussTools/DetTrackInfo.h"
-
-/** @class GaussTrackInformation GaussTrackInformation.h
- *
- *  Class which is used to store auxilliary information about G4Track,
- *
- *  @author  Witek Pokorski Witold.Pokorski@cern.ch
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    23/02/2001
- */
-
-///
-class GaussTrackInformation : public G4VUserTrackInformation
-{
-public:
-  // the actual tyep of hit conatiner
-  typedef std::vector<GaussHitBase*> Hits;
-public:
-
-  /// default (empty) constructor
-  GaussTrackInformation() ;
-
-  /** copy constructor
-   *  @param right object to be copied
-   */
-  GaussTrackInformation( const GaussTrackInformation& right );
-
-  /// destructor
-  virtual ~GaussTrackInformation() ;
-
-  /// clone (virtual constructor)
-  virtual GaussTrackInformation* clone() const ;
-
-  /// overloaded operator new
-  void* operator new    ( size_t );
-
-  /// overloaded operator delete
-  void  operator delete ( void*  );
-
-  /// needed by base class
-  void Print      () const override {};
-
-  /// flag to append the step
-  bool appendStep () const { return m_appendStep ; }
-
-  /** set new value for flag to append step
-   *  @param value new value of the flag
-   */
-  GaussTrackInformation& setAppendStep ( const bool value )
-  { m_appendStep = value ; return *this ; }
-
-  /// flag to force the saving of track into traectory
-  bool toBeStored () const { return m_toBeStored ; }
-
-  /** set new value for flag to force the saving track into trajectory
-   *  @param value new value of the flag
-   */
-  GaussTrackInformation& setToBeStored ( const bool value )
-  { m_toBeStored = value ; return *this ; }
-
-  /// track created a hit
-  bool createdHit() const { return m_createdHit ; }
-
-  /** set new value for flag
-   *  @param value new value of the flag
-   */
-  GaussTrackInformation& setCreatedHit ( const bool value )
-  { m_createdHit = value ; return *this ; }
-
-  // Retrieve if direct parent particle has been stored or not
-  bool directParent() const {return m_directParent;}
-
-  // Set if direct parent particle has been stored or not
-  GaussTrackInformation& setDirectParent(const bool value)
-  { m_directParent = value; return *this;}
-
-  /// Get flag to store or not in internal HepMC structure
-  bool storeHepMC() const {return m_storeHepMC;}
-
-  /// Set value of flag to store or not in internal HepMC structure
-  GaussTrackInformation& setStoreHepMC(const bool value)
-  { m_storeHepMC = value; return *this;}
-
-  /** add hit pointer
-   *  @param hit hit to be added into list of connected hits
-   */
-  GaussTrackInformation& addHit    ( GaussHitBase* hit )
-  { if ( 0 != hit ) { m_hits.push_back( hit ) ; } ; return *this ; }
-
-  /** add hit pointer
-   *  @param hit hit to be added into list of connected hits
-   */
-  GaussTrackInformation& addToHits ( GaussHitBase* hit )
-  { return addHit( hit ) ; }
-
-  // get the container of hits
-  const Hits& hits() const { return m_hits ; }
-
-  /** update Tracks IDs in hits
-   *  (set the new track ID for all connected hits)
-   *  @param trackID new value of trackID
-   */
-  GaussTrackInformation& updateHitsTrackID( G4int trackID )
-  {
-    for( Hits::iterator ihit = m_hits.begin() ; m_hits.end() != ihit ; ++ihit )
-      {
-        GaussHitBase* hit = *ihit ;
-        if( 0 != hit ) { hit->setTrackID( trackID ); }
-      }
-    return *this ;
-  }
-
-  /** get the pointer to the detInfo
-   */
-  DetTrackInfo* detInfo() const { return  m_detInfo; }
-
-  /** set the pointer to the detInfo
-   *  @param aDetInfo pointer to DetTrackInfo
-   */
-  void setDetInfo ( DetTrackInfo* aDetInfo )
-  { m_detInfo = aDetInfo; }
-
-
-private:
-
-  /// flag indicating that TrajectoryPoint should be appended
-  bool m_appendStep ;
-  /// flag indicating that track is forced to be stored into trajectory
-  bool m_toBeStored ;
-  /// flag indicating that track created a hit
-  bool m_createdHit ;
-  /// flag indicating that the direct parent particle was not stored
-  /// in HepMC event this will be represented by a special 'dummy' link
-  bool m_directParent;
-  // flag indicating that the track should be stored in HepMC record
-  bool m_storeHepMC;
-
-  /// vector of pointers to hits created by that track
-  Hits  m_hits;
-
-  /// pointer to a specialised DetTrackInfo object containing detector-specific
-  /// track information
-  DetTrackInfo* m_detInfo;
-
-};
-
-
-// ===========================================================================
-/** @fn  gaussTrackInformation
- *  @param  g4  pointer to G4VUserTrackInformation object
- *  @return cast (dynamic or static to GaussTrackInformation
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline GaussTrackInformation*
-gaussTrackInformation ( G4VUserTrackInformation* g4 )
-{
-  GiGaUtil::FastCast<G4VUserTrackInformation,GaussTrackInformation> cast;
-  return cast( g4 );
-}
-
-
-// ===========================================================================
-/** @fn  gaussTrackInformation
- *  @param  g4  pointer to G4VUserTrackInformation object
- *  @return cast (dynamic or static to GaussTrackInformation
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    2002-12-07
- */
-// ============================================================================
-inline const GaussTrackInformation*
-gaussTrackInformation ( const G4VUserTrackInformation* g4 )
-{
-  GiGaUtil::FastCast<
-    const G4VUserTrackInformation,const GaussTrackInformation> cast;
-  return cast( g4 );
-}
-
-// ============================================================================
-#endif   ///<  GIGA_GaussTrackInformation_H
-
diff --git a/Sim/GaussTools/GaussTools/GaussTrackInformation.icpp b/Sim/GaussTools/GaussTools/GaussTrackInformation.icpp
deleted file mode 100755
index e03e46e09d87852a1de68bcf76391b6c3c2f44fe..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/GaussTools/GaussTrackInformation.icpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// $Id: GaussTrackInformation.icpp,v 1.2 2002-12-07 21:19:13 ibelyaev Exp $ 
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $ 
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// ============================================================================
-#ifndef     GaussTools_GaussTrackInformation_ICPP
-#define     GaussTools_GaussTrackInformation_ICPP 1 
-// ============================================================================
-
-/** implementation of inline methods from class GaussTrackInformation 
- *  
- *  @author Vanya Belyaev 
- */
-
-// ============================================================================
-#endif  //  GaussTools_GaussTrackInformation_ICPP
-// ============================================================================
-
-
-
diff --git a/Sim/GaussTools/src/Components/GaussTrackActionHepMC.cpp b/Sim/GaussTools/src/Components/GaussTrackActionHepMC.cpp
deleted file mode 100755
index 83312ca34b399d6945693397f1bd69028b4e2b0b..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/src/Components/GaussTrackActionHepMC.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-// $Id: GaussTrackActionHepMC.cpp,v 1.9 2008-10-20 08:23:11 robbep Exp $
-// Include files 
-
-// STD & STL 
-#include <functional>
-#include <algorithm>
-
-// from Gaudi
-
-// from LHCb 
-#include "Kernel/IParticlePropertySvc.h"
-#include "Kernel/ParticleProperty.h"
-
-// G4
-#include "Geant4/G4TrackingManager.hh"
-#include "Geant4/G4PrimaryParticle.hh"
-
-// GiGa 
-#include "GiGa/IGiGaSvc.h"
-#include "GiGa/GiGaUtil.h"
-#include "GiGaCnv/GiGaPrimaryParticleInformation.h"
-
-// LHCb
-#include "Event/MCVertex.h"
-
-// Gauss
-#include "GaussTools/GaussTrackInformation.h"
-
-// local 
-#include "GaussTrackActionHepMC.h"
-
-// ============================================================================
-/** @file 
- *  
- *  Implementation file for class : GaussTrackActionHepMC
- *  @date 24/07/2001 
- *  @author Witek Pokorski
- */
-// ============================================================================
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( GaussTrackActionHepMC )
-
-// ============================================================================
-/** standard constructor 
- *  @see GiGaTrackActionBase 
- *  @see GiGaBase 
- *  @see AlgTool 
- *  @param type type of the object (?)
- *  @param name name of the object
- *  @param parent  pointer to parent object
- */
-// ============================================================================
-GaussTrackActionHepMC::GaussTrackActionHepMC
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent ) 
-  : GiGaTrackActionBase( type , name , parent  ) 
-{
-  m_mcMgr = MCTruthManager::GetInstance();
-
-  m_hadronicProcesses.clear();
-  m_hadronicProcesses.push_back( "KaonPlusInelastic"             ) ;
-  m_hadronicProcesses.push_back( "PionMinusAbsorptionAtRest"     ) ;
-  m_hadronicProcesses.push_back( "KaonZeroLInelastic"            ) ;
-  m_hadronicProcesses.push_back( "KaonZeroSInelastic"            ) ;
-  m_hadronicProcesses.push_back( "MuonMinusCaptureAtRest"        ) ; 
-  m_hadronicProcesses.push_back( "TritonInelastic"               ) ;
-  m_hadronicProcesses.push_back( "KaonMinusAbsorption"           ) ;
-  m_hadronicProcesses.push_back( "LambdaInelastic"               ) ;
-  m_hadronicProcesses.push_back( "SigmaMinusInelastic"           ) ;
-  m_hadronicProcesses.push_back( "LCapture"                      ) ;
-  m_hadronicProcesses.push_back( "AntiNeutronAnnihilationAtRest" ) ;
-  m_hadronicProcesses.push_back( "AntiProtonAnnihilationAtRest"  ) ;  
-  m_hadronicProcesses.push_back( "AntiLambdaInelastic"           ) ;
-  m_hadronicProcesses.push_back( "AntiXiZeroInelastic"           ) ;
-  m_hadronicProcesses.push_back( "AntiSigmaPlusInelastic"        ) ;
-  m_hadronicProcesses.push_back( "SigmaPlusInelastic"            ) ;
-  m_hadronicProcesses.push_back( "XiMinusInelastic"              ) ;
-  m_hadronicProcesses.push_back( "XiZeroInelastic"               ) ;
-  m_hadronicProcesses.push_back( "AntiSigmaMinusInelastic"       ) ;
-  m_hadronicProcesses.push_back( "AntiXiMinusInelastic"          ) ;
-  m_hadronicProcesses.push_back( "OmegaMinusInelastic"           ) ;
-  m_hadronicProcesses.push_back( "AntiOmegaMinusInelastic"       ) ;
-  m_hadronicProcesses.push_back( "AlphaInelastic"                ) ;
-  
-  std::sort ( m_hadronicProcesses.begin () ,
-              m_hadronicProcesses.end   () ) ;
-  
-}
-
-
-// ============================================================================
-/// destructor 
-// ============================================================================
-GaussTrackActionHepMC::~GaussTrackActionHepMC() {}
-
-
-// ============================================================================
-/** initialise the action object 
- *  @return status code
- */ 
-// ============================================================================
-StatusCode GaussTrackActionHepMC::initialize () 
-{
-  StatusCode sc = GiGaTrackActionBase::initialize();
-  if( sc.isFailure() ) 
-  { return Error("Could not initialize the base class!", sc ); }
-
-  m_ppSvc = svc<LHCb::IParticlePropertySvc> ( "LHCb::ParticlePropertySvc", true );
-
-  return Print("Iinitialized successfully" , 
-               StatusCode::SUCCESS         , MSG::VERBOSE );
-}
-
-// ============================================================================
-// finalize
-// ============================================================================
-StatusCode GaussTrackActionHepMC::finalize() {
-
-  debug() << "==> Finalize" << endmsg;
-
-  return GiGaTrackActionBase::finalize();  // must be called after all other actions
-}
-
-// ============================================================================
-/** perform the pre-action
- *  @param track pointer to Geant4 track object 
- */ 
-// ============================================================================
-void GaussTrackActionHepMC::PreUserTrackingAction  ( const G4Track* track )
-{
-  // new track is being started
-  // we record its initial momentum 
-  fourmomentum = HepMC::FourVector( track->GetMomentum().x(),
-                                    track->GetMomentum().y(),
-                                    track->GetMomentum().z(),
-                                    track->GetTotalEnergy() );
-
-  // This should have been done in GaussPostTrackAction, but check here
-  if( !track->GetUserInformation() ) {    
-    GaussTrackInformation* mcinf = new GaussTrackInformation();
-    trackMgr()->SetUserTrackInformation(mcinf);
-  }
-
-  // Reset momentum in the case of short lived from HepMC
-//  if( track->GetDefinition()->IsShortLived() ) {
-//    if( NULL != track->GetDynamicParticle() ) {
-//      if( NULL != track->GetDynamicParticle()->GetPrimaryParticle() ) {
-//        G4VUserPrimaryParticleInformation* g4uInf = 
-//          track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation();
-//        if( g4uInf ) {
-//          GiGaPrimaryParticleInformation* uInf = 
-//            (GiGaPrimaryParticleInformation*) g4uInf;
-//          HepMC::GenEvent* gEvt = uInf->pHepMCEvent()->pGenEvt();
-//          HepMC::GenParticle* gPart = 
-//            gEvt->barcode_to_particle( uInf->signalBarcode() );
-//          fourmomentum = gPart->momentum();
-//        }
-//      }
-//    }
-//  }
-
-}
-
-
-// ============================================================================
-/** perform the post-action
- *  @param track pointer to Geant4 track object 
- */ 
-// ============================================================================
-void GaussTrackActionHepMC::PostUserTrackingAction  ( const G4Track* track )
-{
-  
-//   HepMC::GenEvent* genevt = m_mcMgr->GetCurrentEvent();
-  
-  // if track is to be stored, create new GenParticle, and its decay vertex
-  // we check the flag (store or not store) in the GaussTrackInformation
-  GaussTrackInformation* ginf = (GaussTrackInformation*) track->GetUserInformation();
-
-  if( ginf->storeHepMC() ) {
-    HepMC::FourVector prodpos(track->GetVertexPosition().x(),
-                              track->GetVertexPosition().y(),
-                              track->GetVertexPosition().z(),
-                              track->GetGlobalTime() - track->GetLocalTime());
-    HepMC::FourVector endpos(track->GetPosition().x(), 
-                             track->GetPosition().y(), 
-                             track->GetPosition().z(), 
-                             track->GetGlobalTime());
-
-    // Get the pdgID+LHCb extension
-    int pdgID = track->GetDefinition()->GetPDGEncoding();
-    if( 0 == pdgID ) {
-      // Use dynamic particle PDG Id in this case (unknown particle)
-      if ( NULL != track -> GetDynamicParticle() ) {
-        if ( NULL != track -> GetDynamicParticle() -> GetPrimaryParticle() ) {
-          pdgID = track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetPDGcode() ;
-          if ( "unknown" == track->GetDefinition()->GetParticleName() ) {
-            double ener = 
-              sqrt( track->GetDynamicParticle()->GetPrimaryParticle()->GetMomentum().mag2() + 
-                    track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetMass() * 
-                    track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetMass() ) ;
-            fourmomentum.setPx( track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetMomentum().x() ) ;
-            fourmomentum.setPy( track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetMomentum().y() ) ;
-            fourmomentum.setPz( track -> GetDynamicParticle() -> GetPrimaryParticle() -> GetMomentum().z() ) ;
-            fourmomentum.setE( ener ) ;
-          }
-        }
-      } 
-      if ( 0 == pdgID ) {
-        // Last chance, use name of particle
-        const LHCb::ParticleProperty* pProp = 
-          m_ppSvc->find( track->GetDefinition()->GetParticleName() );
-        if( NULL != pProp ) {
-          pdgID = pProp->pdgID().pid();
-        } else {
-          std::string message = "PDGEncoding does not exist, G4 name is ";
-          message += track->GetDefinition()->GetParticleName();
-          Warning( message, StatusCode::SUCCESS, 10 );
-        }
-      }
-    }
-    // get the process type of the origin vertex
-    int creatorID = processID( track->GetCreatorProcess() );
-
-    // Get User information from primary particle to set Vertex type 
-    // OscillatedAndDecay and to set SignalFlag
-    bool hasOscillated = false;
-    LHCb::MCParticle * mcp = 0 ;
-    bool isSignal = false;
-    if( NULL != track->GetDynamicParticle() ) {
-      if( NULL != track->GetDynamicParticle()->GetPrimaryParticle() ) {
-        G4VUserPrimaryParticleInformation* g4uInf = 
-          track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation();
-        if( g4uInf ) {
-          GiGaPrimaryParticleInformation* uInf = 
-            (GiGaPrimaryParticleInformation*) g4uInf;
-          hasOscillated = uInf->hasOscillated();
-          mcp = uInf -> motherMCParticle() ;
-          isSignal = uInf -> isSignal();
-        }
-      }
-    }
-
-    m_mcMgr->AddParticle( fourmomentum, prodpos, endpos,
-                          pdgID, track->GetTrackID(), track->GetParentID(), 
-                          ginf->directParent(), creatorID, mcp , hasOscillated,
-                          isSignal );
-  }
-
-  // For the moment the following is in GaussPostTrackAction
-//   else {
-//     // If track is not to be stored, propagate it's parent ID (stored) to its
-//     // secondaries.    
-//     G4TrackVector* childrens = trackMgr()->GimmeSecondaries() ;
-//     //
-//     for( unsigned int index = 0 ; index < childrens->size() ; ++index )
-//     {
-//       G4Track* tr = (*childrens)[index] ;
-//       //
-//       tr->SetParentID( track->GetParentID() );
-//       // set the flag saying that the direct mother is not stored
-//       GaussTrackInformation* mcinf = (GaussTrackInformation*) tr->GetUserInformation();
-//       if(!mcinf) tr->SetUserInformation( mcinf = new GaussTrackInformation() );
-//       mcinf->setDirectParent( false ); 
-//       //
-//     }     
-//   }
-  
-}
-
-// ============================================================================
-// processID
-// ============================================================================
-int GaussTrackActionHepMC::processID(const G4VProcess* creator ) { 
-
-  int processID = LHCb::MCVertex::Unknown;
-  if( NULL == creator ) {
-    processID = LHCb::MCVertex::DecayVertex;
-    return processID;
-  }
-  
-  if( fDecay == creator->GetProcessType() ) {
-    processID = LHCb::MCVertex::DecayVertex;
-  }
-  else if ( fHadronic == creator->GetProcessType() ) { 
-    processID = LHCb::MCVertex::HadronicInteraction;
-  }
-  else {
-    const std::string& pname = creator->GetProcessName();
-    if( "conv"== pname ) { 
-      processID = LHCb::MCVertex::PairProduction;
-    } else if( "compt" == pname ) {
-      processID = LHCb::MCVertex::Compton;
-    } else if( "eBrem" == pname || "muBrems" == pname ) {
-      processID = LHCb::MCVertex::Bremsstrahlung;
-    } else if( "annihil" == pname ) {
-      processID = LHCb::MCVertex::Annihilation;
-    } else if( "phot" == pname ) {
-      processID = LHCb::MCVertex::PhotoElectric;
-    } else if( "RichHpdPhotoelectricProcess" == pname ) {
-      processID = LHCb::MCVertex::RICHPhotoElectric;
-    } else if( "RichPmtPhotoelectricProcess" == pname ) {
-      processID = LHCb::MCVertex::RICHPhotoElectric;
-    } else if( "TorchTBMcpPhotoElectricProcess" == pname ) {
-      processID = LHCb::MCVertex::RICHPhotoElectric;
-    } else if( "RichG4Cerenkov" == pname ) {
-      processID = LHCb::MCVertex::Cerenkov;
-    } else if( "eIoni" == pname || "hIoni" == pname || "ionIoni" == pname ||
-               "muIoni" == pname ) {
-      processID = LHCb::MCVertex::DeltaRay;
-    } else {
-      const bool found = std::binary_search( m_hadronicProcesses.begin() , 
-                                             m_hadronicProcesses.end(), pname );
-      if( found ) { 
-        processID = LHCb::MCVertex::HadronicInteraction; 
-      }
-    }
-  }
-  
-  if( processID == 0 ) {
-    // here we have an intertsting situation
-    // the process is *KNOWN*, but the vertex type 
-    // is still 'Unknown'
-    std::string message = "The process is known '" + 
-      G4VProcess::GetProcessTypeName ( creator->GetProcessType() ) + "/" +
-      creator -> GetProcessName() + "', but vertex type is still 'Unknown'";
-    Warning( message, StatusCode::SUCCESS, 10 );
-  }        
-
-  return processID;
-  
-}
-
-// ============================================================================
diff --git a/Sim/GaussTools/src/Components/GaussTrackActionHepMC.h b/Sim/GaussTools/src/Components/GaussTrackActionHepMC.h
deleted file mode 100755
index 36749bc51a8ee35ade9c69f2992aeba39f208ef3..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/src/Components/GaussTrackActionHepMC.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// $Id: GaussTrackActionHepMC.h,v 1.4 2008-07-26 15:43:15 robbep Exp $
-#ifndef COMPONENT_GAUSSTRACKACTIONHEPMC_H
-#define COMPONENT_GAUSSTRACKACTIONHEPMC_H 1
-
-// STD & STL
-#include <string>
-#include <vector>
-// GiGa
-#include "GiGa/GiGaTrackActionBase.h"
-// Gauss
-#include "GaussTools/MCTruthManager.h"
-namespace LHCb {
-  class IParticlePropertySvc;
-}
-
-/** @class GaussTrackActionHepMC GaussTrackActionHepMC.h
- *
- *  @author Witek Pokorski
- *  @date   24/07/2001
- */
-
-class GaussTrackActionHepMC: public GiGaTrackActionBase
-{
-  /// friend factory for instantiation
-  //friend class GiGaFactory<GaussTrackActionHepMC>;
-  ///
-public:
-
-  /** initialize the track action
-   *  @see GiGaTrackActionBase
-   *  @see GiGaBase
-   *  @see  AlgTool
-   *  @see IAlgTool
-   *  @return status code
-   */
-  StatusCode initialize () override;
-
-  /** initialize the track action
-   *  @see GiGaTrackActionBase
-   *  @see GiGaBase
-   *  @see  AlgTool
-   *  @see IAlgTool
-   *  @return status code
-   */
-  StatusCode finalize () override;
-
-  /** perform the pre-action
-   *  @see G4UserTrackingAction
-   *  @param track pointer to Geant4 track object
-   */
-  void PreUserTrackingAction  ( const G4Track* track ) override;
-
-  /** perform the post-action
-   *  @see G4UserTrackingAction
-   *  @param track pointer to Geant4 track object
-   */
-  void PostUserTrackingAction ( const G4Track* track ) override;
-
-  //protected:
-
-  /** standard constructor
-   *  @see GiGaTrackActionBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
-   */
-  GaussTrackActionHepMC
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~GaussTrackActionHepMC();
-
-private:
-
-  /// no default constructor
-  GaussTrackActionHepMC();
-  /// no copy constructor
-  GaussTrackActionHepMC( const GaussTrackActionHepMC& );
-  /// no assignment
-  GaussTrackActionHepMC& operator=( const GaussTrackActionHepMC& );
-
-private:
-
-  int processID(const G4VProcess* creator );
-
-  MCTruthManager*        m_mcMgr;
-  LHCb::IParticlePropertySvc*  m_ppSvc;
-  HepMC::FourVector      fourmomentum;
-
-  std::vector<std::string> m_hadronicProcesses;
-
-};
-
-#endif
diff --git a/Sim/GaussTools/src/Components/TrCutsRunAction.cpp b/Sim/GaussTools/src/Components/TrCutsRunAction.cpp
deleted file mode 100755
index f9dea293d7569ba1cd2e9013d7fc25a296b917ff..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/src/Components/TrCutsRunAction.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-// $Id: TrCutsRunAction.cpp,v 1.16 2009-05-26 17:14:36 gcorti Exp $
-// Include files 
-
-// from Gaudi
-
-// G4
-#include "Geant4/G4ParticleTable.hh"
-#include "Geant4/G4ParticleDefinition.hh"
-#include "Geant4/G4ProcessManager.hh"
-
-// local
-#include "MinEkineCuts.h"
-#include "LoopCuts.h"
-#include "WorldCuts.h"
-#include "PingPongCut.h"
-#include "KillAtOriginCut.h"
-#include "ZeroStepsCut.h"
-#include "TrCutsRunAction.h"
-
-
-// ============================================================================
-/** @file 
- *
- *  Implementation file for class : TrCutsRunAction
- *
- *  @author Witek Pokorski Witold.Pokorski@cern.ch
- *  @date 10/04/2003 
- */
-// ============================================================================
-
-// Declaration of the Tool Factory
-DECLARE_COMPONENT( TrCutsRunAction )
-
-// ============================================================================
-/** standard constructor 
- */
-// ============================================================================
-TrCutsRunAction::TrCutsRunAction
-( const std::string& type   ,
-  const std::string& name   ,
-  const IInterface*  parent ) 
-  : GiGaRunActionBase( type , name , parent )
-    , m_ecut(1.0) //MeV
-    , m_phcut(1.0) //MeV
-    , m_pKpicut( 10.0 ) //MeV
-    , m_ocut(0.0) //MeV
-    , m_ncut(10.0) //MeV
-    , m_nucut(0.0) //MeV
-    , m_mcut(10.0) //MeV
-    , m_killloops(true)
-    , m_maxsteps(100)
-    , m_minstep(0.001)
-    , m_minx(-10000.0), m_miny(-10000.0), m_minz(-5000.0)
-    , m_maxx(10000.0), m_maxy(10000.0), m_maxz(25000.0)
-{  
-  declareProperty("ElectronTrCut", m_ecut);
-  declareProperty("GammaTrCut", m_phcut);
-  declareProperty("pKpiCut" , m_pKpicut ) ;
-  declareProperty("NeutronTrCut", m_ncut);
-  declareProperty("NeutrinoTrCut", m_nucut);
-  declareProperty("MuonTrCut", m_mcut);
-  declareProperty("OtherTrCut" , m_ocut ) ;
-  declareProperty("KillLoops", m_killloops);
-  declareProperty("MaxNumberSteps", m_maxsteps);
-  declareProperty("MininumStep", m_minstep);
-  declareProperty("MinX", m_minx);
-  declareProperty("MinY", m_miny);
-  declareProperty("MinZ", m_minz);
-  declareProperty("MaxX", m_maxx);
-  declareProperty("MaxY", m_maxy);
-  declareProperty("MaxZ", m_maxz);
-  declareProperty( "KillPingPong", m_killPingPong = true );
-  declareProperty( "MaxNumStepsForPingPong", m_nMaxForPingPong = 1000000 );
-  declareProperty( "MaxNumOfPingPong", m_nMaxOfPingPong = 20 );
-  declareProperty( "MaxStepLenForPingPong", m_stepLenghtPingPong = 1.0e-3 );
-  m_killAtOrigin.push_back(12);
-  m_killAtOrigin.push_back(14);
-  m_killAtOrigin.push_back(16);
-  m_killAtOrigin.push_back(-12);
-  m_killAtOrigin.push_back(-14);
-  m_killAtOrigin.push_back(-16);
-  declareProperty( "DoNotTrackParticles", m_killAtOrigin,
-                   "List of particles to discard at their origin" );
-  //
-  declareProperty( "KillZeroSteps", m_killZeroSteps = true,
-                   "Flag to activate killing particles that make step of zero lenght in a volume" );
-  declareProperty( "NmaxForZeroSteps", m_nStepsForZero = 1000000,
-                   "Number of steps after which to check for zero lenght steps");
-  declareProperty( "StepLenghAsZero", m_zeroMaxLenght = 1.0e-9,
-                   "Lenght of steps below which a steps has to be considered as of zero lenght" );
-  declareProperty( "NZeroSteps", m_maxNZeroSteps = 20,
-                   "Number of consecutive steps of zero lenght after which the particle is killed");
-  declareProperty( "WorldName", m_world = "Universe", 
-                   "Name of the world volume" );
-  
-}
-
-
-// ============================================================================
-/// destructor 
-// ============================================================================
-TrCutsRunAction::~TrCutsRunAction() {}
-
-// ============================================================================
-/** performe the action at the begin of each run 
- *  @param run pointer to Geant4 run object 
- */
-// ============================================================================
-void TrCutsRunAction::BeginOfRunAction( const G4Run* run )
-{
-  if ( 0 == run ) { 
-    Warning( "BeginOfRunAction:: G4Run* points to NULL!" );
-  }
-  
-  // Loop on particles that have been defined and attach process
-  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
-  if ( 0 == particleTable ) {
-    Error( "G4ParticleTable points to NULL!; return! ");
-    return; 
-  }
-  
-  int ii, ptbSiz = particleTable->size();
-  
-  for( ii = 0; ii < ptbSiz; ii++) {
-
-    G4ParticleDefinition* particle = particleTable->GetParticle( ii );
-    
-    if ( 0 == particle ) {
-      Warning ( "G4ParticleDefinition* points to NULL, skip it" ) ;
-      continue;
-    }
-      
-    std::string pname=particle->GetParticleName();
-
-    // Do not attach cuts processes to optical photons nor short lived
-    // particle as will disappear anyway for other reasons!!!
-    if( (pname!="opticalphoton") && ( ! particle->IsShortLived() ) ) {
-      
-      int particleCode = particle->GetPDGEncoding();
-
-      double acut;
-
-      if(abs(particleCode)==11)
-        {
-          acut=m_ecut;
-        }
-      else if(particleCode==22)
-        {
-          acut=m_phcut;
-        }
-      else if(abs(particleCode)==13)
-        {
-          acut=m_mcut;
-        }
-      else if(abs(particleCode)==2112)
-        {
-          acut=m_ncut;
-        }
-      else if(abs(particleCode)==12 || abs(particleCode)==14 
-              || abs(particleCode)==16)
-        {
-          acut=m_nucut;
-        }
-      else if ( (abs(particleCode) == 2212 ) || (abs(particleCode) == 321 )
-                || (abs(particleCode) == 211 ) ) 
-        {
-          acut=m_pKpicut;  
-        }
-      else 
-        {
-          acut = m_ocut ;
-        }      
-
-      if ( (pname!="opticalphoton") && ( ! particle->IsShortLived() ) )
-        {          
-          G4ProcessManager* procMgr = particle->GetProcessManager();
-          if ( 0 == procMgr ) 
-          {
-            Error("G4ProcessManager* points to NULL!") ;
-            return ;
-          }
-
-          for( std::vector<int>::iterator ik = m_killAtOrigin.begin();
-               m_killAtOrigin.end() != ik; ik++ ) {
-
-            if( particleCode == *ik ) {
-              
-              procMgr->AddDiscreteProcess( 
-                       new GiGa::KillAtOriginCut("KillAtOriginCut") );
-            }
-          } // closes loop on particles to kill
-          
-          procMgr->AddDiscreteProcess( new GiGa::MinEkineCuts("MinEkineCut",
-                                                              acut) );
-          procMgr->AddDiscreteProcess( new GiGa::WorldCuts("WorldCut",
-                                                           m_minx, m_miny,
-                                                           m_minz, m_maxx,
-                                                           m_maxy, m_maxz) );
-          if ( (pname=="e-" || pname=="gamma" ) && m_killloops) {
-            procMgr->
-              AddDiscreteProcess( new GiGa::LoopCuts("LoopCuts", m_maxsteps,
-                                                     m_minstep) );
-          }
-          
-          if ( m_killPingPong ) {
-            procMgr->AddDiscreteProcess( new GiGa::PingPongCut("PingPongCut",
-                                                         m_nMaxForPingPong,
-                                                         m_stepLenghtPingPong,
-                                                         m_nMaxOfPingPong) );
-          }
-          if ( m_killZeroSteps ) {
-            procMgr->AddDiscreteProcess( new GiGa::ZeroStepsCut("ZeroStepsCut",
-                                                         m_nStepsForZero,
-                                                         m_zeroMaxLenght,
-                                                         m_maxNZeroSteps,
-                                                         m_world) );
-          }
-          
-        }
-    }
-    
-  }
-  
-}
-
-
-// ============================================================================
-/** performe the action at the end of each run 
- *  @param run pointer to Geant4 run object 
- */
-// ============================================================================
-void TrCutsRunAction::EndOfRunAction( const G4Run* run )
-{
-  
-  if( 0 == run ) { 
-    Warning("EndOfRunAction:: G4Run* points to NULL!"); 
-  }
-
-}
-
-
-// ============================================================================
-// The End
-// ============================================================================
-
diff --git a/Sim/GaussTools/src/Components/TrCutsRunAction.h b/Sim/GaussTools/src/Components/TrCutsRunAction.h
deleted file mode 100755
index 53ac7d554db2ff41562f10c1a546dc7ad4b4f8b1..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/src/Components/TrCutsRunAction.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// $Id: TrCutsRunAction.h,v 1.9 2009-05-26 17:14:34 gcorti Exp $
-#ifndef GAUSSTOOLS_COMPONENTS_TRCUTSRUNACTION_H
-#define GAUSSTOOLS_COMPONENTS_TRCUTSRUNACTION_H 1
-// Include files
-// from GiGa
-#include "GiGa/GiGaRunActionBase.h"
-
-
-/** @class TrCutsRunAction TrCutsRunAction.h
- *
- *  Class to pass Tracking Cuts to Geant4 as processes.
- *  Modified to
- *
- *
- *  @author Witek POKORSKI
- *  @date   2003-04-10
- *  @author Gloria CORTI
- *  @date   2009-03-31
- */
-
-class TrCutsRunAction: public virtual GiGaRunActionBase
-{
-
-public:
-
-  /** performe the action at the begin of each run
-   *  @param run pointer to Geant4 run object
-   */
-  void BeginOfRunAction ( const G4Run* run ) override;
-
-  /** performe the action at the end  of each event
-   *  @param run pointer to Geant4 run object
-   */
-  void EndOfRunAction   ( const G4Run* run ) override;
-
-  //protected:
-
-  /** standard constructor
-   *  @see GiGaPhysListBase
-   *  @see GiGaBase
-   *  @see AlgTool
-   *  @param type type of the object (?)
-   *  @param name name of the object
-   *  @param parent  pointer to parent object
-   */
-  TrCutsRunAction
-  ( const std::string& type   ,
-    const std::string& name   ,
-    const IInterface*  parent ) ;
-
-  // destructor (virtual and protected)
-  virtual ~TrCutsRunAction( );
-
-private:
-
-  ///no default constructor
-  TrCutsRunAction();
-  /// no copy constructor
-  TrCutsRunAction( const TrCutsRunAction& );
-  /// no assignement
-  TrCutsRunAction& operator=( const TrCutsRunAction& );
-
-private:
-
-  double m_ecut;         ///< kinetic energy cut for e+/-
-  double m_phcut;        ///< kinetic energy cut for gamma
-  double m_pKpicut ;     ///< kinetic energy cut for proton, K+/- and pi+/-
-  double m_ocut;         ///< kinetic energy cut for other particles
-  double m_ncut;         ///< kinetic energy cut for neutrons
-  double m_nucut;        ///< kinetic energy cut for neutrinos (when tracked)
-  double m_mcut;         ///< kinetic energy cut for muons
-  bool m_killloops;      ///< kill looping e- and gamma
-  int m_maxsteps;        ///< maximum number of step looping
-  double m_minstep;      ///< minimum lenght for looping cut
-  double m_minx, m_miny, m_minz, m_maxx, m_maxy, m_maxz; ///< world cut limits
-  bool m_killPingPong;   ///< kill particles ping ponging
-  int m_nMaxForPingPong; ///< maximum number of steps to check pingpong
-  int m_nMaxOfPingPong;  ///< maximum number of ping pong
-  double m_stepLenghtPingPong; ///< step lenght to consider in pingpong
-  std::vector<int> m_killAtOrigin; ///< particle to kill at origin (def=neutrino)
-  bool m_killZeroSteps;   ///< kill particle with 'zero' step
-  int m_nStepsForZero;    ///< number of steps after which to check for 'zero' steps
-  double m_zeroMaxLenght; ///< max lenght to consider a step of 'zero' lenght
-  int m_maxNZeroSteps;    ///< number of steps of zero length to trigger cut
-  std::string m_world;    ///< Name of world volume
-
-};
-// ============================================================================
-
-// ============================================================================
-// The END
-// ============================================================================
-#endif ///< GIGA_TRCUTSRUNACTION_H
-// ============================================================================
diff --git a/Sim/GaussTools/src/Lib/GaussTrackInformation.cpp b/Sim/GaussTools/src/Lib/GaussTrackInformation.cpp
deleted file mode 100755
index b0ffb794a5e4dc1fc4cd92659aee29c8b84b9562..0000000000000000000000000000000000000000
--- a/Sim/GaussTools/src/Lib/GaussTrackInformation.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// $Id: GaussTrackInformation.cpp,v 1.5 2006-04-12 19:32:08 gcorti Exp $
-// ============================================================================
-// CVS tag $Name: not supported by cvs2svn $
-// ============================================================================
-// $Log: not supported by cvs2svn $
-// Revision 1.4  2005/10/31 09:29:44  gcorti
-// use HepMC for history during tracking
-//
-// Revision 1.3  2003/07/28 10:26:23  witoldp
-// added WorldCuts and DetTrackInfo
-//
-// Revision 1.2  2003/04/09 12:07:37  witoldp
-// added pointer to RICHInfo
-//
-// Revision 1.1  2002/12/07 21:19:14  ibelyaev
-//  few optimization updates
-// 
-// ============================================================================
-// Include files
-// GiGa 
-#include "GiGa/GiGaUtil.h"
-// local
-#include "GaussTools/GaussTrackInformation.h"
-// G4 
-#include "Geant4/G4Allocator.hh"
-
-// ============================================================================
-/** @file 
- *  Implementation file for class : GaussTrackInformation
- *  @author  Witek Pokorski Witold.Pokorski@cern.ch
- *  @author  Vanya Belyaev Ivan.Belyaev@itep.ru
- *  @date    23/02/2001
- */
-// ============================================================================
-
-// ============================================================================
-namespace GaussTrackInformationLocal
-{
-  // ==========================================================================
-  /** @var s_Allocator 
-   *  G4 allocator for fast creation of many "small" objects 
-   */
-  // ==========================================================================
-  G4Allocator<GaussTrackInformation> s_Allocator;
-  // ==========================================================================
-  /** @var s_Counter 
-   *  static instance counter 
-   */
-  // ==========================================================================
-#ifdef GIGA_DEBUG
-  static GiGaUtil::InstanceCounter<GaussTrackInformation> s_Counter ;
-#endif
-  // ==========================================================================
-}
-
-
-// ============================================================================
-/// default (empty) constructor 
-// ============================================================================
-GaussTrackInformation::GaussTrackInformation()
-  : m_appendStep(false)
-  , m_toBeStored(false)
-  , m_createdHit(false)
-  , m_directParent(true)
-  , m_storeHepMC(false)
-  , m_hits()
-  , m_detInfo(0)
-{
-#ifdef GIGA_DEBUG
-  GaussTrackInformationLocal::s_Counter.increment() ;
-#endif
-}
-
-
-
-// ============================================================================
-/// copy constructor 
-// ============================================================================
-GaussTrackInformation:: GaussTrackInformation 
-( const GaussTrackInformation& right)
-  : G4VUserTrackInformation(right) 
-  , m_appendStep(right.m_appendStep)
-  , m_toBeStored(right.m_toBeStored)
-  , m_createdHit(right.m_createdHit)
-  , m_directParent(right.m_directParent)
-  , m_storeHepMC(right.m_storeHepMC)
-  , m_hits(right.m_hits)
-  , m_detInfo(right.m_detInfo) 
-{
-#ifdef GIGA_DEBUG
-  GaussTrackInformationLocal::s_Counter.increment() ;
-#endif
-}
-
-
-// ============================================================================
-/// clone (virtual constructor)
-// ============================================================================
-GaussTrackInformation* GaussTrackInformation::clone() const 
-{ return new GaussTrackInformation( *this ); }
-// ============================================================================
-
-// ============================================================================
-/// destructor 
-// ============================================================================
-GaussTrackInformation::~GaussTrackInformation() 
-{
-  delete m_detInfo;
-
-#ifdef GIGA_DEBUG
-  GaussTrackInformationLocal::s_Counter.decrement() ;
-#endif
-}
-
-
-// ============================================================================
-/// operator new 
-// ============================================================================
-void* GaussTrackInformation::operator new    ( size_t )
-{ return (void*) GaussTrackInformationLocal::s_Allocator.MallocSingle(); }
-// ============================================================================
-
-// ============================================================================
-/// operator delete 
-// ============================================================================
-void GaussTrackInformation::operator delete ( void*  info  )
-{ 
-  GaussTrackInformationLocal::s_Allocator.FreeSingle
-    ( (GaussTrackInformation*) info ); 
-}
-
-
-// ============================================================================
-// The END 
-// ============================================================================
diff --git a/Sim/GaussTracker/CMakeLists.txt b/Sim/GaussTracker/CMakeLists.txt
index 168cb7337fbdf90592be95fe1467fae47aa7c83c..2e4a9b593ed7dd0ebe4117c8e313994a8ae2b0fa 100644
--- a/Sim/GaussTracker/CMakeLists.txt
+++ b/Sim/GaussTracker/CMakeLists.txt
@@ -1,17 +1,25 @@
 ################################################################################
 # Package: GaussTracker
 ################################################################################
-gaudi_subdir(GaussTracker v7r0p1)
+gaudi_subdir(GaussTracker v8r0)
 
-gaudi_depends_on_subdirs(Sim/GaussTools)
+gaudi_depends_on_subdirs(GaudiAlg
+                         Sim/GiGaMTCore
+                         Det/DetDesc
+                         HepMC3
+                         Sim/GiGaMTFactories)
 
 find_package(Boost)
 find_package(CLHEP)
-include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS})
+AddHepMC3()
+include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Geant4_INCLUDE_DIRS} ${HEPMC3_INCLUDE_DIR})
+
+add_definitions(-DG4MULTITHREADED)
+add_definitions(-DG4USE_STD11)
 
 gaudi_add_module(GaussTracker
                  src/*.cpp
-                 LINK_LIBRARIES GaussToolsLib)
+                 LINK_LIBRARIES DetDescLib Geant4 GiGaMTCoreTruthLib GaudiAlgLib)
 
 gaudi_env(SET GAUSSTRACKEROPTS \${GAUSSTRACKERROOT}/options)
 
diff --git a/Sim/GaussTracker/src/GetTrackerHitsAlg.cpp b/Sim/GaussTracker/src/GetTrackerHitsAlg.cpp
index 4b79fd80833553e1f5bfd913537cd1bc1a65a936..2b6c0a15d6c0537eb9785249a7995b1fb8f3f9ea 100755
--- a/Sim/GaussTracker/src/GetTrackerHitsAlg.cpp
+++ b/Sim/GaussTracker/src/GetTrackerHitsAlg.cpp
@@ -1,23 +1,10 @@
-// $Id: GetTrackerHitsAlg.cpp,v 1.16 2009-03-26 21:52:20 robbep Exp $
-// Include files 
-
-// from Gaudi
-
-// from GiGa 
-#include "GiGa/IGiGaSvc.h"
-#include "GiGa/GiGaHitsByName.h"
-
-// from GiGaCnv
-#include "GiGaCnv/IGiGaKineCnvSvc.h" 
-#include "GiGaCnv/IGiGaCnvSvcLocation.h"
-#include "GiGaCnv/GiGaKineRefTable.h"
-
 // from Geant4
 #include "Geant4/G4HCofThisEvent.hh"
+#include "Geant4/G4SDManager.hh"
 
 // from LHCb
-#include "Event/MCExtendedHit.h"
 #include "DetDesc/DetectorElement.h"
+#include "Event/MCExtendedHit.h"
 
 // local
 #include "GetTrackerHitsAlg.h"
@@ -27,204 +14,140 @@
 // Implementation file for class : GetTrackerHitsAlg
 //
 // 2005-10-02 : Gloria CORTI
+// 2018-04-05 : Dominik Muller
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_COMPONENT( GetTrackerHitsAlg )
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-GetTrackerHitsAlg::GetTrackerHitsAlg( const std::string& name,
-                                                ISvcLocator* pSvcLocator)
-  : GaudiAlgorithm ( name , pSvcLocator )
-  , m_gigaSvc      ( 0 )
-  , m_gigaKineCnvSvc ( 0 )
-{
-  declareProperty( "GiGaService",    m_gigaSvcName  = "GiGa",
-                   "The service handling the intreface to Geant4" );
-  declareProperty( "KineCnvService", m_kineSvcName  = IGiGaCnvSvcLocation::Kine,
-                   "The service keeping the relation between Geant4 kinematic and MCTruth" );
-  declareProperty( "ExtendedInfo",   m_extendedInfo = false, 
-                   "Flag to control filling of MCExtendedHits instead of MCHits (def = false)" );
-  declareProperty( "MCHitsLocation", m_hitsLocation = "",
-                   "Location in TES where to put resulting MCHits" );
-  declareProperty( "CollectionName", m_colName = "",
-                   "Name of Geant4 collection where to retrieve hits" );
-  declareProperty( "Detectors",      m_detName,
-                   "List of detector paths in TDS for which to retrieve the hits (most of the time one" );
-  declareProperty( "MCParticles",    m_mcParticles = LHCb::MCParticleLocation::Default,
-		   "Location of MCParticles" ) ;
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-GetTrackerHitsAlg::~GetTrackerHitsAlg() {}
+DECLARE_COMPONENT(GetTrackerHitsAlg)
 
 //=============================================================================
 // Initialization
 //=============================================================================
 StatusCode GetTrackerHitsAlg::initialize() {
+    StatusCode sc = GaudiAlgorithm::initialize();  // must be executed first
+    if (sc.isFailure()) return sc;  // error printed already by GaudiAlgorithm
+
+    debug() << "==> Initialize" << endmsg;
+
+    if ("" == m_colName) {
+        fatal() << "Property CollectionName need to be set! " << endmsg;
+        return StatusCode::FAILURE;
+    }
 
-  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-
-  debug() << "==> Initialize" << endmsg;
-
-  if( "" == m_hitsLocation ) {
-    fatal() << "Property MCHitsLocation need to be set! " << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if( "" == m_colName ) {
-    fatal() << "Property CollectionName need to be set! " << endmsg;
-    return StatusCode::FAILURE;
-  }
-  if( !m_detName.size() ) {
-    warning() << "Property Detector need to be set! " << endmsg;
-  }
-
-  std::vector<std::string>::iterator itDet;
-  debug() << " The hits " << m_hitsLocation  << endmsg;
-  debug() << " will be taken from G4 collection " << m_colName  << endmsg;
+    auto& hit_outputhandle = std::get<0>(m_outputs);
+    std::vector<std::string>::iterator itDet;
+    debug() << " The hits " << hit_outputhandle.objKey() << endmsg;
+    debug() << " will be taken from G4 collection " << m_colName << endmsg;
+    debug() << endmsg;
+
+    // FIXME: Should become a tool
+    // get the detector element
   debug() << " for detector(s) ";
-  for( itDet=m_detName.begin(); itDet!=m_detName.end(); itDet++ ){
-    debug() << *itDet << " ";
-  }
-  debug() << endmsg;
-  
-  m_gigaSvc = svc<IGiGaSvc>( m_gigaSvcName ); // GiGa has to already exist!
-
-  // get kineCnv service that hold the MCParticle/Geant4 table list
-  m_gigaKineCnvSvc = svc<IGiGaKineCnvSvc>( m_kineSvcName );
-
-  // get the detector element
-  for( itDet=m_detName.begin(); itDet!=m_detName.end(); itDet++ ){
-    m_detector.push_back( getDet<DetectorElement>(*itDet) );
-  }
-  
-  return StatusCode::SUCCESS;
+    for (itDet = m_detName.begin(); itDet != m_detName.end(); itDet++) {
+        debug() << *itDet << " ";
+        m_detector.push_back(getDet<DetectorElement>(*itDet));
+    }
+
+    return StatusCode::SUCCESS;
 }
 
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode GetTrackerHitsAlg::execute() {
-
-  debug() << "==> Execute" << endmsg;
-
-  if( 0 == gigaSvc() ) {
-    return Error( " execute(): IGiGaSvc* points to NULL" );
-  }
-
-  // Create the MCHits and put them in the TES
-  // Cannot use 
-  // MCHits* hits = getOrCreate<MCHits,MCHits>( m_hitsLocation );
-  // because triggers convertion
-  LHCb::MCHits* hits = new LHCb::MCHits();
-  put( hits, m_hitsLocation );
-  
-  // Get the G4 necessary hit collection from GiGa
-  GiGaHitsByName col( m_colName );
-  *gigaSvc() >> col;   // also StatusCode sc = retrieveHitCollection( col );
-                       // in TRY/CATCH&PRINT
-  
-  if( 0 == col.hits() ) { 
-    return Warning( "The hit collection='" + m_colName + "' is not found!",
-                    StatusCode::SUCCESS ); 
-  }
-  
-  const TrackerHitsCollection* hitCollection = trackerHits( col.hits() );
-  if( 0 == hitCollection ) { 
-    return Error( "Wrong Collection type" );
-  }
-  
-  // The MCParticles should have already been filled
-  if( !( exist<LHCb::MCParticles>( m_mcParticles ) ) ) {
-    return Error( "MCParticles do not exist at'" 
-                  + m_mcParticles +"'" );
-  }
-  
-  // reserve elements on output container
-  int numOfHits = hitCollection->entries();
-  if( numOfHits > 0 ) {
-    hits->reserve( numOfHits );
-  }
-
-  // tranform G4Hit into MCHit and insert it in container
-  for( int iG4Hit = 0; iG4Hit < numOfHits; ++iG4Hit ) { 
-    
-    // create hit or extended hit depending on choice
-    if ( m_extendedInfo ) {
-      LHCb::MCExtendedHit* newHit = new LHCb::MCExtendedHit();
-      fillHit( (*hitCollection)[iG4Hit], newHit );
-      Gaudi::XYZVector mom( (*hitCollection)[iG4Hit]->GetMomentum() );
-      newHit->setMomentum( mom );
-      hits->add( newHit );
+LHCb::MCHits GetTrackerHitsAlg::operator()(
+    const G4EventProxies& eventproxies,
+    const LinkedParticleMCParticleLinks& mcp_links) const {
+    debug() << "==> Execute" << endmsg;
+
+    // Create the MCHits and put them in the TES
+    // Cannot use
+    // MCHits* hits = getOrCreate<MCHits,MCHits>( m_hitsLocation );
+    // because triggers convertion
+    LHCb::MCHits hits;
+
+    for (auto& ep : eventproxies) {
+        auto hitCollection =
+            ep.GetHitCollection<TrackerHitsCollection>(m_colName);
+        if (!hitCollection) {
+            warning() << "The hit collection='" + m_colName + "' is not found!"
+                      << endmsg;
+            continue;
+        }
+        // reserve elements on output container
+        int numOfHits = hitCollection->entries();
+        // tranform G4Hit into MCHit and insert it in container
+        for (int iG4Hit = 0; iG4Hit < numOfHits; ++iG4Hit) {
+            // create hit or extended hit depending on choice
+            if (m_extendedInfo) {
+                LHCb::MCExtendedHit* newHit = new LHCb::MCExtendedHit();
+                fillHit((*hitCollection)[iG4Hit], newHit, ep.truth(),
+                        mcp_links);
+                Gaudi::XYZVector mom((*hitCollection)[iG4Hit]->GetMomentum());
+                newHit->setMomentum(mom);
+                hits.add(newHit);
+            } else {
+                LHCb::MCHit* newHit = new LHCb::MCHit();
+                fillHit((*hitCollection)[iG4Hit], newHit, ep.truth(),
+                        mcp_links);
+                hits.add(newHit);
+            }
+        }
     }
-    else {
-      LHCb::MCHit* newHit = new LHCb::MCHit();
-      fillHit( (*hitCollection)[iG4Hit], newHit );
-      hits->add( newHit );
-    }
-  }
-  
-  // Check that all hits have been transformed
-  if( (size_t) hits->size() != (size_t) hitCollection->entries() ) {
-    return Error("MCHits and G4TrackerHitsCollection have different sizes!");
-  }  
-
-  return StatusCode::SUCCESS;
-  
+
+    return hits;
 }
 
 //=============================================================================
 //  Finalize
 //=============================================================================
 StatusCode GetTrackerHitsAlg::finalize() {
+    debug() << "==> Finalize" << endmsg;
 
-  debug() << "==> Finalize" << endmsg;
-
-  return GaudiAlgorithm::finalize();  // must be called after all other actions
+    return GaudiAlgorithm::finalize();  // must be called after all other
+                                        // actions
 }
 
 //=============================================================================
-//  Fill MCHit 
+//  Fill MCHit
 //=============================================================================
 
-void GetTrackerHitsAlg::fillHit( TrackerHit* g4Hit, LHCb::MCHit* mcHit ) {
-  
-  // fill data members
-  Gaudi::XYZPoint entry( g4Hit->GetEntryPos() );
-  Gaudi::XYZPoint exit( g4Hit->GetExitPos() );
-  mcHit->setEntry( entry );
-  mcHit->setDisplacement( exit-entry );
-  mcHit->setEnergy( g4Hit->GetEdep() );
-  mcHit->setTime( g4Hit->GetTimeOfFlight() );
-  mcHit->setP( g4Hit->GetMomentum().mag() );
- 
-  // get sensitive detector identifier using mid point
-  int detID = -1;
-  std::vector<const DetectorElement*>::iterator itDet;
-  for( itDet=m_detector.begin(); itDet!=m_detector.end(); itDet++){
-    if( (*itDet)->isInside(mcHit->midPoint()) ){
-      detID = (*itDet)->sensitiveVolumeID( mcHit->midPoint() );
-      break;
+void GetTrackerHitsAlg::fillHit(
+    TrackerHit* g4Hit, LHCb::MCHit* mcHit, const Gaussino::MCTruth* mctruth,
+    const LinkedParticleMCParticleLinks& mcplinks) const {
+    // fill data members
+    Gaudi::XYZPoint entry(g4Hit->GetEntryPos());
+    Gaudi::XYZPoint exit(g4Hit->GetExitPos());
+    mcHit->setEntry(entry);
+    mcHit->setDisplacement(exit - entry);
+    mcHit->setEnergy(g4Hit->GetEdep());
+    mcHit->setTime(g4Hit->GetTimeOfFlight());
+    mcHit->setP(g4Hit->GetMomentum().mag());
+
+    // get sensitive detector identifier using mid point
+    // FIXME: This needs to be added once geometry has been worked in
+    int detID = -1;
+    // FIXME: put this into a tool so it can be configured when using DD4hep
+    for (auto itDet = m_detector.begin(); itDet != m_detector.end(); itDet++) {
+        if ((*itDet)->isInside(mcHit->midPoint())) {
+            detID = (*itDet)->sensitiveVolumeID(mcHit->midPoint());
+            break;
+        }
+    }
+    mcHit->setSensDetID(detID);
+
+    // fill reference to MCParticle using the Geant4->MCParticle table
+    int trackID = g4Hit->GetTrackID();
+    if (auto lp = mctruth->GetParticleFromTrackID(trackID); lp) {
+        if (auto it = mcplinks.find(lp); it != std::end(mcplinks)) {
+            mcHit->setMCParticle(it->second);
+        } else {
+            warning() << "No pointer to MCParticle for MCHit associated to G4 "
+                         "trackID: "
+                      << trackID << endmsg;
+        }
+    } else {
+        warning() << "No LinkedParticle found. Something went seriously wrong. "
+                     "trackID: "
+                  << trackID << endmsg;
     }
-  }
-  mcHit->setSensDetID(detID);
-
-  // fill reference to MCParticle using the Geant4->MCParticle table
-  GiGaKineRefTable& table = kineSvc()->table();
-  int trackID = g4Hit->GetTrackID();
-  if( table[trackID].particle() ) {
-    mcHit->setMCParticle( table[trackID].particle() );
-  } else {
-    warning() << "No pointer to MCParticle for MCHit associated to G4 trackID: "
-              << trackID << endmsg;
-  }
-  
 }
-
-//=============================================================================
diff --git a/Sim/GaussTracker/src/GetTrackerHitsAlg.h b/Sim/GaussTracker/src/GetTrackerHitsAlg.h
index 40bbf0bc79f26cb49e9570694a35f82b60e5b6b8..39657950ef2e88ceaf4ff7cf92c524f627bc25ef 100755
--- a/Sim/GaussTracker/src/GetTrackerHitsAlg.h
+++ b/Sim/GaussTracker/src/GetTrackerHitsAlg.h
@@ -1,20 +1,22 @@
-// $Id: GetTrackerHitsAlg.h,v 1.6 2009-03-26 21:52:20 robbep Exp $
-#ifndef GETTRACKERHITSALG_H
-#define GETTRACKERHITSALG_H 1
+#pragma once
+#include <vector>
 
 // Include files
 // from Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
-
+#include "GaudiAlg/Transformer.h"
+#include "GaudiKernel/DataHandle.h"
+#include "GiGaMTCoreRun/G4EventProxy.h"
+#include "GiGaMTCoreTruth/MCTruthConverter.h"
+#include "MCTruthToEDM/LinkedParticleMCParticleLink.h"
+
+#include "Defaults/Locations.h"
+#include "Event/MCHit.h"
 // Forward declarations
 class IGiGaSvc;
 class IGiGaKineCnvSvc;
 class DetectorElement;
 class TrackerHit;
-namespace LHCb {
-  class MCHit;
-}
-
 
 /** @class GetTrackerHitsAlg GetTrackerHitsAlg.h
  *
@@ -22,52 +24,51 @@ namespace LHCb {
  *  @author Gloria CORTI
  *  @date   2005-10-02
  */
-class GetTrackerHitsAlg : public GaudiAlgorithm {
-public:
+class GetTrackerHitsAlg
+    : public Gaudi::Functional::Transformer<LHCb::MCHits(
+          const G4EventProxies&, const LinkedParticleMCParticleLinks&)> {
+  public:
   /// Standard constructor
-  GetTrackerHitsAlg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~GetTrackerHitsAlg( ); ///< Destructor
-
-  StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
-  StatusCode finalize  () override;    ///< Algorithm finalization
-
-protected:
-
-  /** accessor to GiGa Service
-   *  @return pointer to GiGa Service
-   */
-  IGiGaSvc* gigaSvc() const {
-    return m_gigaSvc;
-  }
-
-  /** accessor to kinematics  conversion service
-   *  @return pointer to kinematics conversion service
-   */
-  IGiGaKineCnvSvc*      kineSvc   () const {
-    return m_gigaKineCnvSvc;
-  }
-
-  void fillHit( TrackerHit* g4Hit, LHCb::MCHit* mcHit );
-
-
-private:
-
-  std::string        m_gigaSvcName;      ///< Name of GiGa Service
-  std::string        m_kineSvcName;      ///< Name of GiGaCnv Service
-  IGiGaSvc*          m_gigaSvc;          ///< Pointer to GiGa Service
-  IGiGaKineCnvSvc*   m_gigaKineCnvSvc;   ///< Pointer to GiGaKine Service
-
-  bool               m_extendedInfo;     ///< Flag to fill MCHit or MCExtendedHit
-
-  std::string        m_hitsLocation;     ///< Name of TES path for MCHits
-  std::string        m_colName;          ///< Name of G4 hits collection
-
-  std::vector<std::string> m_detName;             ///< Detector PATHs
+  GetTrackerHitsAlg(const std::string& name, ISvcLocator* pSvcLocator)
+      : Transformer(
+            name, pSvcLocator,
+            {{KeyValue{"Input", Gaussino::G4EventsLocation::Default},
+              KeyValue{
+                  "LinkedParticleMCParticleLinks",
+                  Gaussino::LinkedParticleMCParticleLinksLocation::Default}}},
+            KeyValue{"MCHitsLocation", ""}) {}
+  virtual ~GetTrackerHitsAlg() = default;
+
+  virtual LHCb::MCHits operator()(const G4EventProxies&, const LinkedParticleMCParticleLinks&) const override;
+
+  virtual StatusCode initialize() override;  ///< Algorithm initialization
+  virtual StatusCode finalize() override;    ///< Algorithm finalization
+
+  // declareProperty( "GiGaService",    m_gigaSvcName  = "GiGa",
+  //"The service handling the intreface to Geant4" );
+  // declareProperty( "KineCnvService", m_kineSvcName  =
+  // IGiGaCnvSvcLocation::Kine, "The service keeping the relation between Geant4
+  // kinematic and MCTruth" );
+  Gaudi::Property<bool> m_extendedInfo{this, "ExtendedInfo", false,
+                                       "Flag to control filling of "
+                                       "MCExtendedHits instead of MCHits (def "
+                                       "= false)"};
+  Gaudi::Property<std::string> m_colName{
+      this, "CollectionName", "",
+      "Name of Geant4 collection where to retrieve hits"};
+  Gaudi::Property<std::vector<std::string>> m_detName{
+      this,
+      "Detectors",
+      {},
+      "List of detector paths in TDS for which to retrieve the hits (most of "
+      "the time one"};
+  // declareProperty( "MCParticles",    m_mcParticles =
+  // LHCb::MCParticleLocation::Default, "Location of MCParticles" ) ;
+
+  protected:
+  void fillHit(TrackerHit* g4Hit, LHCb::MCHit* mcHit,const Gaussino::MCTruth* mctruth, const LinkedParticleMCParticleLinks& mcplinks) const;
+
+  private:
+  std::string m_mcParticles;  ///< Name of MCParticles location
   std::vector<const DetectorElement*> m_detector; ///< Pointers to DetectorEl
-
-  std::string        m_mcParticles;       ///< Name of MCParticles location
-
 };
-#endif // GETTRACKERHITSALG_H
diff --git a/Sim/GaussTracker/src/GiGaSensDetTracker.cpp b/Sim/GaussTracker/src/GiGaSensDetTracker.cpp
index 9d3a2a1dc142289926c6e78531b6b1025f520b84..4aec953634a420a4559cc74537130a91137835db 100755
--- a/Sim/GaussTracker/src/GiGaSensDetTracker.cpp
+++ b/Sim/GaussTracker/src/GiGaSensDetTracker.cpp
@@ -1,5 +1,5 @@
 // $Id: GiGaSensDetTracker.cpp,v 1.14 2009-06-10 16:57:25 gcorti Exp $
-// Include files 
+// Include files
 
 // from CLHEP
 #include "CLHEP/Geometry/Point3D.h"
@@ -7,14 +7,14 @@
 // from Gaudi
 #include "GaudiKernel/MsgStream.h"
 
-// from Geant4 
+// from Geant4
+#include "Geant4/G4HCofThisEvent.hh"
+#include "Geant4/G4LogicalVolume.hh"
+#include "Geant4/G4SDManager.hh"
 #include "Geant4/G4Step.hh"
-#include "Geant4/G4Track.hh"
 #include "Geant4/G4TouchableHistory.hh"
+#include "Geant4/G4Track.hh"
 #include "Geant4/G4VPhysicalVolume.hh"
-#include "Geant4/G4LogicalVolume.hh"
-#include "Geant4/G4SDManager.hh"
-#include "Geant4/G4HCofThisEvent.hh"
 #include "Geant4/G4ios.hh"
 
 // local
@@ -26,110 +26,73 @@
 // 2006-07-14 : Gloria CORTI (clean up)
 //-----------------------------------------------------------------------------
 
-// Declaration of the Factory
-DECLARE_COMPONENT( GiGaSensDetTracker )
+GiGaSensDetTracker::GiGaSensDetTracker(const std::string& name)
+    : G4VSensitiveDetector(name) {
+    collectionName.insert("Hits");
+}
 
+void GiGaSensDetTracker::Initialize(G4HCofThisEvent* HCE) {
+    m_trackerCol =
+        new TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-GiGaSensDetTracker::GiGaSensDetTracker( const std::string& type,
-                                        const std::string& name,
-                                        const IInterface*  parent ) 
-  : G4VSensitiveDetector( name  )
-  , GiGaSensDetBase     ( type , name , parent ) 
-{  
+    std::string hit_location = SensitiveDetectorName + "/" + collectionName[0];
 
-  collectionName.insert( "Hits" );
-  declareProperty( "RequireEDep", m_requireEDep = true,
-                   "Flag to control storing of hits if track deposited energy or not" );
+    debug("Registering location at " + hit_location);
+    int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(hit_location);
 
+    HCE->AddHitsCollection(HCID, m_trackerCol);
 }
 
-//=============================================================================
-// Destructor
-//=============================================================================
-GiGaSensDetTracker::~GiGaSensDetTracker(){}
-
-
-//=============================================================================
-// Initialize method from G4 (Called at the begin of each G4event)
-// see G4VSensitiveDetector 
-// ============================================================================
-void GiGaSensDetTracker::Initialize(G4HCofThisEvent*HCE) {
-  
-  m_trackerCol = new TrackerHitsCollection( SensitiveDetectorName,
-                                            collectionName[0] );
-  
-  int HCID = G4SDManager::GetSDMpointer()
-    ->GetCollectionID( SensitiveDetectorName + "/" + collectionName[0] );
-
-  HCE->AddHitsCollection(HCID, m_trackerCol);
-
-  Print (" Initialize(): CollectionName='" + m_trackerCol->GetName   () +
-         "' for SensDet='"                 + m_trackerCol->GetSDname () + 
-         "'" , StatusCode::SUCCESS , MSG::VERBOSE                       ).ignore() ;
-  
-}
+bool GiGaSensDetTracker::ProcessHits(G4Step* step,
+                                     G4TouchableHistory* /* history */) {
+    if (0 == step) {
+        return false;
+    }
 
+    G4Track* track = step->GetTrack();
+    G4double charge = track->GetDefinition()->GetPDGCharge();
 
-//=============================================================================
-// process the hit (G4 method)
-//=============================================================================
-bool GiGaSensDetTracker::ProcessHits( G4Step* step , 
-                                      G4TouchableHistory* /* history */ ) 
-{
-  if( 0 == step ) { return false; } 
-  
-  G4Track* track=step->GetTrack();
-  G4double charge = track->GetDefinition()->GetPDGCharge();
-  
-  if( charge == 0.0 ) { return false; }   // fill hits only for charged tracks
-  
-  // If required to have energy deposition check
-  double edep = step->GetTotalEnergyDeposit();
-  if( m_requireEDep && ( edep <= 0.0 ) ) {
-    return false;
-  }
-  
-  if( step->GetStepLength() != 0.0 ) {     // step must be finite
-
-    Print("Filling a hit", StatusCode::SUCCESS, MSG::VERBOSE).ignore();
-
-    G4ThreeVector prepos  = step->GetPreStepPoint()->GetPosition();
-    double timeof = step->GetPreStepPoint()->GetGlobalTime();
-    G4ThreeVector premom = step->GetPreStepPoint()->GetMomentum();
-    
-    TrackerHit* newHit = new TrackerHit();
-    newHit->SetEdep( edep );
-    newHit->SetEntryPos( prepos );
-    newHit->SetTimeOfFlight( timeof );
-    newHit->SetMomentum( premom );
-
-    // Store exit point
-    G4ThreeVector postpos  = step->GetPostStepPoint()->GetPosition();
-    newHit->SetExitPos( postpos );
-    
-    // Set id to track 
-    int trid = track->GetTrackID();
-    newHit->SetTrackID( trid );
-
-    G4VUserTrackInformation* ui = track->GetUserInformation(); 
-    GaussTrackInformation* gi = (GaussTrackInformation*) ui;
-    gi->setCreatedHit(true);
-    gi->setToBeStored(true);
-    gi->addHit(newHit);
-
-    // add hit to collection
-    m_trackerCol->insert( newHit );    
-    return true;
-    
-  }
-
-  return false;
-  
-}
+    if (charge == 0.0) {
+        return false;
+    }  // fill hits only for charged tracks
+
+    // If required to have energy deposition check
+    double edep = step->GetTotalEnergyDeposit();
+    if (m_requireEDep && (edep <= 0.0)) {
+        return false;
+    }
+
+    if (step->GetStepLength() != 0.0) {  // step must be finite
+
+        debug("Filling a hit");
+
+        G4ThreeVector prepos = step->GetPreStepPoint()->GetPosition();
+        double timeof = step->GetPreStepPoint()->GetGlobalTime();
+        G4ThreeVector premom = step->GetPreStepPoint()->GetMomentum();
 
-//=============================================================================
+        TrackerHit* newHit = new TrackerHit();
+        newHit->SetEdep(edep);
+        newHit->SetEntryPos(prepos);
+        newHit->SetTimeOfFlight(timeof);
+        newHit->SetMomentum(premom);
 
+        // Store exit point
+        G4ThreeVector postpos = step->GetPostStepPoint()->GetPosition();
+        newHit->SetExitPos(postpos);
 
+        // Set id to track
+        int trid = track->GetTrackID();
+        newHit->SetTrackID(trid);
+
+        auto gi = GaussinoTrackInformation::Get(track);
+        gi->setCreatedHit(true);
+        gi->setToStoreTruth(true);
+        gi->addHit(newHit);
+
+        // add hit to collection
+        m_trackerCol->insert(newHit);
+        return true;
+    }
+
+    return false;
+}
diff --git a/Sim/GaussTracker/src/GiGaSensDetTracker.h b/Sim/GaussTracker/src/GiGaSensDetTracker.h
index d2806f7d55ae4679af4b0ddd7f161eeaddbac58b..afabcfb8f8e188d30f8ba4f1439f2704d3dae0dd 100755
--- a/Sim/GaussTracker/src/GiGaSensDetTracker.h
+++ b/Sim/GaussTracker/src/GiGaSensDetTracker.h
@@ -1,10 +1,9 @@
-// $Id: GiGaSensDetTracker.h,v 1.6 2008-05-07 07:05:44 gcorti Exp $
-#ifndef GIGASENSDETTRACKER_H
-#define GIGASENSDETTRACKER_H 1
+#pragma once
 
 // Include files
-#include "GiGa/GiGaSensDetBase.h"
-#include "GaussTools/GaussTrackInformation.h"
+#include "GiGaMTCoreTruth/GaussinoTrackInformation.h"
+#include "GiGaMTCoreMessage/IGiGaMessage.h"
+#include "Geant4/G4VSensitiveDetector.hh"
 #include "TrackerHit.h"
 
 // Forward declarations
@@ -12,7 +11,6 @@ class G4Step;
 class G4HCofThisEvent;
 class G4TouchableHistory;
 
-
 /** @class GiGaSensDetTracker GiGaSensDetTracker.h
  *
  *  Fill information in TrackerHits to be later stored
@@ -21,28 +19,19 @@ class G4TouchableHistory;
  *
  *  @author Witek POKORSKI
  *  @author Gloria CORTI
- *  @date   2006-07-17 (last revision)
+ *  @author Dominik Muller
+ *  @date   2018-12-18 (last revision)
  */
-class GiGaSensDetTracker: virtual public GiGaSensDetBase
-{
-
-public:
-
-  /// Standard constructor
-  GiGaSensDetTracker( const std::string& type   ,
-                      const std::string& name   ,
-                      const IInterface*  parent ) ;
-
-  /// destructor (virtual and protected)
-  virtual ~GiGaSensDetTracker();
-
+class GiGaSensDetTracker : public G4VSensitiveDetector, public virtual GiGaMessage {
+  public:
+  GiGaSensDetTracker(const std::string& name);
 
   /** Initialize method (Geant4).
    *  Called at the beginning of each event
    *  @see G4VSensitiveDetector
    *  @param HCE pointer to hit collection of current event
    */
-  void Initialize( G4HCofThisEvent* HCE ) override;
+  void Initialize(G4HCofThisEvent* HCE) override;
 
   /** Process a hit (Geant4).
    *  The method is invoked by G4 for each step in the
@@ -58,24 +47,20 @@ public:
    *  @param step     pointer to current Geant4 step
    *  @param history  pointer to touchable history
    */
-  bool ProcessHits( G4Step* step,
-                    G4TouchableHistory* history ) override;
+  bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
 
-private:
+  // Flag to control storing of hits if track deposited energy or not
+  void SetRequireEDep(bool val = true) { m_requireEDep = val; }
 
-  GiGaSensDetTracker(); ///< no default constructor
-  GiGaSensDetTracker( const GiGaSensDetTracker& ); ///< no copy constructor
-  GiGaSensDetTracker& operator=( const GiGaSensDetTracker& ) ; ///< no =
+  private:
+  GiGaSensDetTracker();                           ///< no default constructor
+  GiGaSensDetTracker(const GiGaSensDetTracker&);  ///< no copy constructor
+  GiGaSensDetTracker& operator=(const GiGaSensDetTracker&);  ///< no =
 
   /// Pointer to G4 collection for this sensitive detector
   TrackerHitsCollection* m_trackerCol;
 
   /// Flag to store hits if dE/dx occured, this is to enable hits when
   /// switching it off for special studies (like with geantinos)
-  bool m_requireEDep;
-
+  bool m_requireEDep = true;
 };
-
-
-#endif  // GIGASENSDETTRACKER_H
-
diff --git a/Sim/GaussTracker/src/GiGaSensDetTrackerFAC.cpp b/Sim/GaussTracker/src/GiGaSensDetTrackerFAC.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..66b2bbed5591c105e25a2a26f30c7683ca15ae77
--- /dev/null
+++ b/Sim/GaussTracker/src/GiGaSensDetTrackerFAC.cpp
@@ -0,0 +1,25 @@
+// Include files
+
+#include "GiGaMTFactories/GiGaMTG4SensDetFactory.h"
+
+// Geant4 physics lists
+#include "GiGaSensDetTracker.h"
+
+typedef GiGaMTG4SensDetFactory<GiGaSensDetTracker> TrackerBaseFAC;
+
+class GiGaSensDetTrackerFAC: public TrackerBaseFAC
+{
+  Gaudi::Property<bool> m_requireEDep{this, "RequireEDep", true,
+                                      "Hits must have non-zero Energy deposition"};
+
+public:
+  using TrackerBaseFAC::TrackerBaseFAC;
+  GiGaSensDetTracker* construct() const override
+  {
+    auto tmp = TrackerBaseFAC::construct();
+    tmp->SetRequireEDep(m_requireEDep);
+    return tmp;
+  }
+};
+
+DECLARE_COMPONENT_WITH_ID( GiGaSensDetTrackerFAC, "GiGaSensDetTracker" )
diff --git a/Sim/GaussTracker/src/TrackerHit.cpp b/Sim/GaussTracker/src/TrackerHit.cpp
index 63d16d987056696655aca91d225072644e9f4dfc..f4b6f029b289fb0bf6d493fdc973523ab9af32eb 100755
--- a/Sim/GaussTracker/src/TrackerHit.cpp
+++ b/Sim/GaussTracker/src/TrackerHit.cpp
@@ -3,6 +3,7 @@
 //
 // 16/05/2002 : Witold POKORSKI
 // 25/07/2006 : Gloria CORTI
+// 18/12/2018 : Dominik Muller
 //-----------------------------------------------------------------------------
 
 // Include files 
@@ -15,124 +16,7 @@
 // local
 #include "TrackerHit.h"
 
-G4Allocator<TrackerHit> TrackerHitAllocator;
-
-//=============================================================================
-// Default Constructor
-//=============================================================================
-TrackerHit::TrackerHit() { }
-
-//=============================================================================
-// Destructor
-//=============================================================================
-TrackerHit::~TrackerHit() {}
-
-//=============================================================================
-// Constructor
-//=============================================================================
-TrackerHit::TrackerHit(const TrackerHit &right)
-  : GaussHitBase(right)
-{
-  m_edep = right.m_edep;
-  m_entryPos = right.m_entryPos;
-  m_exitPos = right.m_exitPos;
-  m_timeOfFlight = right.m_timeOfFlight;
-  m_momentum = right.m_momentum;
-}
-
-//=============================================================================
-// new operator (fast G4 allocator)
-//=============================================================================
-void* TrackerHit::operator new(size_t)
-{
-  void *aHit;
-  aHit = (void *) TrackerHitAllocator.MallocSingle();
-  return aHit;
-}
-
-//=============================================================================
-// delete operator (fast G4 allocator)
-//=============================================================================
-void TrackerHit::operator delete(void *aHit)
-{
-  TrackerHitAllocator.FreeSingle((TrackerHit*) aHit);
-}
-
-//=============================================================================
-// assignmnet operator
-//=============================================================================
-const TrackerHit& TrackerHit::operator=(const TrackerHit &right)
-{
-  m_edep = right.m_edep;
-  m_entryPos = right.m_entryPos;
-  m_exitPos = right.m_exitPos;
-  m_timeOfFlight = right.m_timeOfFlight;
-  m_momentum = right.m_momentum;
-  return *this;
-}
-
-//=============================================================================
-// equality operator
-//=============================================================================
-int TrackerHit::operator==(const TrackerHit& /*right*/ ) const
-{
-  return 0;
-}
-
-//=============================================================================
-// Accessors for energy deposition
-//=============================================================================
-void TrackerHit::SetEdep(G4double de) { 
-  m_edep = de; 
-}
-
-G4double TrackerHit::GetEdep() { 
-  return m_edep; 
-}
-
-//=============================================================================
-// Accessors for entry point
-//=============================================================================
-void TrackerHit::SetEntryPos(G4ThreeVector xyz) { 
-  m_entryPos = xyz; 
-}
-
-G4ThreeVector TrackerHit::GetEntryPos() {
-  return m_entryPos; 
-}
-
-//=============================================================================
-// Accessors for exit point
-//=============================================================================
-void TrackerHit::SetExitPos(G4ThreeVector xyz) { 
-  m_exitPos = xyz; 
-}
-
-G4ThreeVector TrackerHit::GetExitPos() { 
-  return m_exitPos; 
-}
-
-//=============================================================================
-// Accessors for time of flight at entry point
-//=============================================================================
-void TrackerHit::SetTimeOfFlight(G4double tof) { 
-  m_timeOfFlight = tof; 
-}
-
-G4double TrackerHit::GetTimeOfFlight() { 
-  return m_timeOfFlight;
-}
-
-//=============================================================================
-// Accessors for momentum at entry point
-//=============================================================================
-void TrackerHit::SetMomentum(G4ThreeVector p) {
-  m_momentum = p; 
-}
- 
-G4ThreeVector TrackerHit::GetMomentum() {
-  return m_momentum; 
-} 
+G4ThreadLocal G4Allocator<TrackerHit> *aTrackerHitAllocator = nullptr;
 
 //=============================================================================
 // Draw 
@@ -168,5 +52,3 @@ void TrackerHit::Print() {
             << this->m_momentum.y() << "," << this->m_momentum.z() << ")"
             << std::endl;
 }
-
-//=============================================================================
diff --git a/Sim/GaussTracker/src/TrackerHit.h b/Sim/GaussTracker/src/TrackerHit.h
index d20cde6bb29df280b121f55fa1a2e5782fa68f9e..8db6d67e49bd09d85021610136efe83f76f70fba 100755
--- a/Sim/GaussTracker/src/TrackerHit.h
+++ b/Sim/GaussTracker/src/TrackerHit.h
@@ -1,85 +1,77 @@
-#ifndef TrackerHit_h
-#define TrackerHit_h 1
+#pragma once
 
 /** @class TrackerHit TrackerHit.h component/TrackerHit.h
  *
  *
  *  @author Witold POKORSKI
  *  @author Gloria CORTI
+ *  @author Dominik MULLER
  *  @date   16/05/2002
- *  @date   26/07/2006 (last modified)
+ *  @date   26/07/2006
+ *  @date   18/12/2018 (last modified)
  */
 
-#include "GaussTools/GaussHitBase.h"
-#include "Geant4/G4THitsCollection.hh"
 #include "Geant4/G4Allocator.hh"
+#include "Geant4/G4THitsCollection.hh"
 #include "Geant4/G4ThreeVector.hh"
-
-class TrackerHit : public GaussHitBase
-{
-public:
-
-  TrackerHit();
-  virtual ~TrackerHit();
-  TrackerHit(const TrackerHit &right);
-  const TrackerHit& operator=(const TrackerHit &right);
-  int operator==(const TrackerHit &right) const;
-
-  void *operator new(size_t);
-  void operator delete(void *aHit);
+#include "GiGaMTCoreDet/GaussHitBase.h"
+
+class TrackerHit : public Gaussino::HitBase {
+  public:
+  TrackerHit() = default;
+  virtual ~TrackerHit() = default;
+  TrackerHit(const TrackerHit& right) : Gaussino::HitBase(right) {
+    m_edep = right.m_edep;
+    m_entryPos = right.m_entryPos;
+    m_exitPos = right.m_exitPos;
+    m_timeOfFlight = right.m_timeOfFlight;
+    m_momentum = right.m_momentum;
+  }
+  inline const TrackerHit& operator=(const TrackerHit& right);
+  int operator==(const TrackerHit&) const { return 0; };
+
+  inline void* operator new(size_t);
+  inline void operator delete(void* aHit);
 
   void Draw() override;
   void Print() override;
 
-private:
+  private:
   G4ThreeVector m_entryPos;
   G4ThreeVector m_exitPos;
-  G4double      m_timeOfFlight;
-  G4double      m_edep;
+  G4double m_timeOfFlight;
+  G4double m_edep;
   G4ThreeVector m_momentum;
 
-public:
+  public:
+  inline void SetEdep(G4double de) { m_edep = de; }
+  inline G4double GetEdep() { return m_edep; }
 
-  void SetEdep(G4double de);
-  G4double GetEdep();
+  inline void SetEntryPos(G4ThreeVector xyz) { m_entryPos = xyz; }
+  inline G4ThreeVector GetEntryPos() { return m_entryPos; }
 
-  void SetEntryPos(G4ThreeVector xyz);
-  G4ThreeVector GetEntryPos();
+  inline void SetExitPos(G4ThreeVector xyz) { m_exitPos = xyz; }
+  inline G4ThreeVector GetExitPos() { return m_exitPos; }
 
-  void SetExitPos(G4ThreeVector xyz);
-  G4ThreeVector GetExitPos();
+  inline void SetTimeOfFlight(G4double tof) { m_timeOfFlight = tof; }
+  inline G4double GetTimeOfFlight() { return m_timeOfFlight; }
 
-  void SetTimeOfFlight(G4double tof);
-  G4double GetTimeOfFlight();
-
-  void SetMomentum(G4ThreeVector p);
-  G4ThreeVector GetMomentum();
+  inline void SetMomentum(G4ThreeVector p) { m_momentum = p; }
+  inline G4ThreeVector GetMomentum() { return m_momentum; }
 };
 
 typedef G4THitsCollection<TrackerHit> TrackerHitsCollection;
 
-extern G4Allocator<TrackerHit> TrackerHitAllocator;
+extern G4ThreadLocal G4Allocator<TrackerHit> *aTrackerHitAllocator;
 
-// ============================================================================
-/** @fn  trackerHits
- *  Fast cast of G4VHitsCollection interface to concrete Gauss implementation
- *  @param  g4   pointer to G4VHitsCollection interface
- *  @return cast (dynamic or static) to TrackerHitsColelction*
- */
-// ============================================================================
-inline TrackerHitsCollection* trackerHits( G4VHitsCollection* g4 )
-{
-  GiGaUtil::FastCast<G4VHitsCollection, TrackerHitsCollection> cast ;
-  return cast( g4 );
+inline void* TrackerHit::operator new(size_t) {
+  if (!aTrackerHitAllocator)
+  {
+    aTrackerHitAllocator = new G4Allocator<TrackerHit>;
+  }
+  return (void*)aTrackerHitAllocator->MallocSingle();
 }
 
-inline TrackerHit* trackerHit( G4VHit* g4 )
-{
-  GiGaUtil::FastCast<G4VHit,TrackerHit> cast ;
-  return cast( g4 );
+inline void TrackerHit::operator delete(void* aHit) {
+  aTrackerHitAllocator->FreeSingle((TrackerHit*)aHit);
 }
-// ============================================================================
-
-#endif
-
-
diff --git a/Sim/GaussTracker/src/TrackerHit.icc b/Sim/GaussTracker/src/TrackerHit.icc
new file mode 100644
index 0000000000000000000000000000000000000000..a46d99a1b2f9be3cfde1a30bc905679451010aef
--- /dev/null
+++ b/Sim/GaussTracker/src/TrackerHit.icc
@@ -0,0 +1,67 @@
+//=============================================================================
+// Constructor
+//=============================================================================
+TrackerHit::TrackerHit(const TrackerHit &right)
+  : Gaussino::HitBase(right)
+{
+  m_edep = right.m_edep;
+  m_entryPos = right.m_entryPos;
+  m_exitPos = right.m_exitPos;
+  m_timeOfFlight = right.m_timeOfFlight;
+  m_momentum = right.m_momentum;
+}
+
+//=============================================================================
+// Accessors for energy deposition
+//=============================================================================
+void TrackerHit::SetEdep(G4double de) { 
+  m_edep = de; 
+}
+
+G4double TrackerHit::GetEdep() { 
+  return m_edep; 
+}
+
+//=============================================================================
+// Accessors for entry point
+//=============================================================================
+void TrackerHit::SetEntryPos(G4ThreeVector xyz) { 
+  m_entryPos = xyz; 
+}
+
+G4ThreeVector TrackerHit::GetEntryPos() {
+  return m_entryPos; 
+}
+
+//=============================================================================
+// Accessors for exit point
+//=============================================================================
+void TrackerHit::SetExitPos(G4ThreeVector xyz) { 
+  m_exitPos = xyz; 
+}
+
+G4ThreeVector TrackerHit::GetExitPos() { 
+  return m_exitPos; 
+}
+
+//=============================================================================
+// Accessors for time of flight at entry point
+//=============================================================================
+void TrackerHit::SetTimeOfFlight(G4double tof) { 
+  m_timeOfFlight = tof; 
+}
+
+G4double TrackerHit::GetTimeOfFlight() { 
+  return m_timeOfFlight;
+}
+
+//=============================================================================
+// Accessors for momentum at entry point
+//=============================================================================
+void TrackerHit::SetMomentum(G4ThreeVector p) {
+  m_momentum = p; 
+}
+ 
+G4ThreeVector TrackerHit::GetMomentum() {
+  return m_momentum; 
+} 
diff --git a/Sim/GiGa/.gaudi_project_ignore b/Sim/GiGa/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GiGaCnv/.gaudi_project_ignore b/Sim/GiGaCnv/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/GiGaVisUI/.gaudi_project_ignore b/Sim/GiGaVisUI/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/LbGDML/.gaudi_project_ignore b/Sim/LbGDML/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/SimChecks/.gaudi_project_ignore b/Sim/SimChecks/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Sim/SimSvc/CMakeLists.txt b/Sim/SimSvc/CMakeLists.txt
index c5a49e01d1d0aae997c321aed4e44fa68566443d..f5a291ba1d40e370f102c4b82768a90d2ecf9b62 100644
--- a/Sim/SimSvc/CMakeLists.txt
+++ b/Sim/SimSvc/CMakeLists.txt
@@ -3,15 +3,17 @@
 ################################################################################
 gaudi_subdir(SimSvc v6r0p1)
 
-gaudi_depends_on_subdirs(Det/DetDescCnv)
+gaudi_depends_on_subdirs(Det/DetDescCnv
+                         Sim/GiGaMTGeo
+                         Sim/GiGaMTCore
+                         Sim/GaussGeo)
 
 find_package(Boost)
 find_package(XercesC)
-include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS})
+include_directories(SYSTEM ${Boost_INCLUDE_DIRS}
+                           ${XERCESC_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS})
 
 gaudi_add_module(SimSvc
                  src/*.cpp
-                 LINK_LIBRARIES DetDescCnvLib)
-
-gaudi_install_headers(SimSvc)
-
+                 INCLUDE_DIRS GiGaMTRegions
+                 LINK_LIBRARIES GiGaMTCoreCutLib DetDescCnvLib) 
diff --git a/Sim/SimSvc/SimSvc/ISimulationSvc.h b/Sim/SimSvc/SimSvc/ISimulationSvc.h
deleted file mode 100755
index 7e67f0ba1548cb8c423fa0f8ca786e6cf3c9d503..0000000000000000000000000000000000000000
--- a/Sim/SimSvc/SimSvc/ISimulationSvc.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// $ID:  $
-
-#ifndef SIMSVC_ISIMULATIONSVC_H
-#define SIMSVC_ISIMULATIONSVC_H
-
-// Include files
-#include "GaudiKernel/IInterface.h"
-
-#include "SimSvc/SimAttribute.h"
-#include "SimSvc/RegionCuts.h"
-#include <map>
-
-// Forward and external declarations
-class ILVolume;
-
-/// Declaration of the interface ID (interface id, major version, minor version)
-static const InterfaceID IID_ISimulationSvc(948, 1 , 0);
-
-
-/** @class ISimulationSvc ISimulationSvc.h SimDesc/ISimulationSvc.h
- *
- *  this interface defines a Simulation service that is able to answer
- *  many question concerning the simulation of the detector. It
- *  is able to associate simulation attributes to logical volumes.
- *  These describe the way these volumes should be simulated
- *
- *  @author Sebastien Ponce
- */
-
-class ISimulationSvc : virtual public IInterface {
-  
-public:
-
-  // typedefs used  
-  typedef std::map<int, const SimAttribute*> PartAttr;
-  typedef std::vector<RegionCuts> VectOfRegCuts;
-
-  /// Retrieve interface ID
-  static const InterfaceID& interfaceID() { return IID_ISimulationSvc; }
-
-  /**
-   * This method returns the simulation attribute associated to a given
-   * logical volume.
-   * @param vol the logical volume
-   * @return the simulation attribute that should be used to simulate
-   * this logical volume
-   */
-  virtual const PartAttr* simAttribute (const ILVolume* vol) const = 0;
-
-  /**
-   * This method returns the simulation attribute associated to a given
-   * logical volume.
-   * @param vol the logical volume
-   * @return the simulation attribute that should be used to simulate
-   * this logical volume
-   */
-  virtual const PartAttr* simAttribute (const std::string volname) const = 0;
-
-  /**
-   * This method tells whether a simulation attribute is associated to a given
-   * logical volume or not
-   * @param vol the logical volume
-   */
-  virtual bool hasSimAttribute (const ILVolume* vol) const = 0;
-
-  /**
-   * This method tells whether a simulation attribute is associated to a given
-   * logical volume or not
-   * @param vol the logical volume
-   */
-  virtual bool hasSimAttribute (const std::string volname) const = 0;
-
-  /**
-   * This method returns the pointer to the vector of region definitions.
-   * @param 
-   * @return std::vector<RegionCuts>
-   */
-  virtual const std::vector<RegionCuts>* regionsDefs () const = 0;
-
-  /**
-   * this method erases the current set of attributes and loads a new set
-   */
-  virtual void reload () = 0;
-
-};
-
-#endif // SIMSVC_ISIMULATIONSVC_H
diff --git a/Sim/SimSvc/SimSvc/RegionCuts.h b/Sim/SimSvc/SimSvc/RegionCuts.h
deleted file mode 100755
index f7986b0be88c07efc569112d60e676d1a7fecdde..0000000000000000000000000000000000000000
--- a/Sim/SimSvc/SimSvc/RegionCuts.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// $Id: RegionCuts.h,v 1.3 2009-10-15 12:41:13 silviam Exp $
-#ifndef SIMSVC_REGIONCUTS_H 
-#define SIMSVC_REGIONCUTS_H 1
-
-// Include files
-#include <string>
-#include <vector>
-
-/** @class RegionCuts RegionCuts.h SimSvc/RegionCuts.h
- *  
- *
- *  @author Witold POKORSKI
- *  @date   2003-06-03
- */
-class RegionCuts {
-public:
-  /// Default constructor
-  RegionCuts( ):
-    m_regionName("unknown"),
-    m_volumes(),
-    m_gammacut(-1.0),
-    m_electroncut(-1.0),
-    m_positroncut(-1.0),
-    m_protoncut(-1.0),
-    m_aprotoncut(-1.0),
-    m_neutroncut(-1.0),
-    m_aneutroncut(-1.0)
-  {}; 
-  
-  /// Standard constructor
-  RegionCuts(std::string name,
-             std::vector<std::string> volumes,
-             double gammacut,
-             double electroncut,
-             double positroncut,
-             double protoncut,
-             double aprotoncut,
-             double neutroncut,
-             double aneutroncut):
-    m_regionName(name),
-    m_volumes(volumes),
-    m_gammacut(gammacut),
-    m_electroncut(electroncut),
-    m_positroncut(positroncut),
-    m_protoncut(protoncut),
-    m_aprotoncut(-aprotoncut),
-    m_neutroncut(neutroncut),
-    m_aneutroncut(aneutroncut)
-  {};
-  
-  const std::string& region() const 
-  {
-    return m_regionName;
-  }
-
-  const std::vector<std::string>& volumes() const
-  {
-    return m_volumes;
-  }
-  
-  double gammaCut() const
-  {
-    return m_gammacut;
-  }
-  double electronCut() const
-  {
-    return m_electroncut;
-  }
-  double positronCut() const
-  {
-    return m_positroncut;
-  }
-  double protonCut() const
-  {
-    return m_protoncut;
-  }
-  double antiProtonCut() const
-  {
-    return m_aprotoncut;
-  }
-  double neutronCut() const
-  {
-    return m_neutroncut;
-  }
-  double antiNeutronCut() const
-  {
-    return m_aneutroncut;
-  }
-  
-private:
-
-  std::string m_regionName;
-  std::vector<std::string> m_volumes;
-
-  double m_gammacut;
-  double m_electroncut;
-  double m_positroncut;
-  double m_protoncut;
-  double m_aprotoncut;
-  double m_neutroncut;
-  double m_aneutroncut;  
-
-};
-#endif // SIMSVC_REGIONCUTS_H
diff --git a/Sim/SimSvc/SimSvc/SimAttribute.h b/Sim/SimSvc/SimSvc/SimAttribute.h
deleted file mode 100755
index 7149b6936000f5112109cd36422721ae9f8a0a85..0000000000000000000000000000000000000000
--- a/Sim/SimSvc/SimSvc/SimAttribute.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// $Id: SimAttribute.h,v 1.3 2009-10-15 12:41:20 silviam Exp $
-#ifndef SIMATTRIBUTE_H 
-#define SIMATTRIBUTE_H 1
-
-// Include files
-
-/** @class SimAttribute SimAttribute.h
- *  This encapsulated the definition of simulation attributes for
- *  a logical volume. Included attributes are :
- *     - the maximum number of steps
- *     - the maximum track length
- *     - the maximum time
- *     - the minimal kinetic energy
- *     - the minimal remaining range
- *
- *  @author Sebastien Ponce
- */
-class SimAttribute {
-
-public:
-  /// Default constructor
-  SimAttribute () :
-    m_maxAllowedStep(-1.0),
-    m_maxTrackLength(-1.0),
-    m_maxTime(-1.0),
-    m_minEkine(-1.0),
-    m_minRange(-1.0)
-  {};
-
-  /// Standard constructor
-  SimAttribute (double maxAllowedStep,
-                double maxTrackLength,
-                double maxTime,
-                double minEkine,
-                double minRange) :
-    m_maxAllowedStep(maxAllowedStep),
-    m_maxTrackLength(maxTrackLength),
-    m_maxTime(maxTime),
-    m_minEkine(minEkine),
-    m_minRange(minRange)
-  {};  
-
-  /**
-   * Get accessor to member m_maxAllowedStep
-   * @return the current value of m_maxAllowedStep
-   */
-  double maxAllowedStep () const {
-    return m_maxAllowedStep;
-  }
-
-  /**
-   * Get accessor to member m_maxTrackLength
-   * @return the current value of m_maxTrackLength
-   */
-  double maxTrackLength () const {
-    return m_maxTrackLength;
-  }
-
-  /**
-   * Get accessor to member m_maxTime
-   * @return the current value of m_maxTime
-   */
-  double maxTime () const {
-    return m_maxTime;
-  }
-
-  /**
-   * Get accessor to member m_minEkine
-   * @return the current value of m_minEkine
-   */
-  double minEkine () const {
-    return m_minEkine;
-  }
-
-  /**
-   * Get accessor to member m_minRange
-   * @return the current value of m_minRange
-   */
-  double minRange () const {
-    return m_minRange;
-  }
-
-private:
-  double m_maxAllowedStep;
-  double m_maxTrackLength;
-  double m_maxTime;
-  double m_minEkine;
-  double m_minRange;
-};
-#endif // SIMATTRIBUTE_H
diff --git a/Sim/SimSvc/doc/release.notes b/Sim/SimSvc/doc/release.notes
deleted file mode 100755
index 41905f21e9682b338d2029484ca0c6b906af44e1..0000000000000000000000000000000000000000
--- a/Sim/SimSvc/doc/release.notes
+++ /dev/null
@@ -1,114 +0,0 @@
-!-----------------------------------------------------------------------------
-! Package     : Sim/SimSvc
-! Responsible : Gloria Corti, originally Sebastien Ponce
-! Purpose     : description of simulation parameters associated to logical
-!               volumes
-!-----------------------------------------------------------------------------
-
-!========================== SimSvc v6r0p1 2015-01-16 =========================
-! 2014-11-20 - Gloria Corti
- - Fixes for warning with --pedantic
- 
-! 2014-11-19 - Marco Clemencic
- - Updated CMake configuration
-
-!=========================== SimSvc v6r0 2014-02-02 ==========================
-! 2013-12-20 - Marco Clemencic
- - Removed obsolete file (not working with Gaudi >= v25).
-
-!========================== SimSvc v5r2p1 2013-10-10 =========================
-! 2013-09-23 - Marco Clemencic
- - Added CMake configuration file.
-
-!=========================== SimSvc v5r2 2009-11-04 ==========================
-! 2009-10-15 - Silvia Miglioranzi
- - Fix compilation warnings on slc5 "type qualifiers ignored on function return 
-   type" in:
-   - ISimulationSvc.h
-   - RegionCuts.h
-   - SimAttribute.h
-   - SimulationSvc.cpp
-   - SimulationSvc.h
-
-!=========================== SimSvc v5r1 2007-02-08 ==========================
-! 2007-12-12 - Gloria Corti
- - Adapt to location of Simulation.xml in Gauss package for default file
-   . SimulationSvc.cpp
-
-!==================== SimSvc v5r0 2007-03-16 =================================
-! 2007-03-16 - Gloria Corti
- - Modified to follow the changes in LHCb v22r1 XmlTools
-   . SimulationSvc.cpp
-
-! 2007-01-12 - Gloria Corti
- - Use install area for includes for Gaudi v19r0
-   . requirements
- - Use Gaudi macros for factory declarations (Gaudi v19r0)
-   . SimSvc_load.cpp
-   . SimulationSvc.cpp
-
-!======================== SimSvc v4r2 ==================================
-! 2005-11-10 - Gloria CORTI
- - src/SimulationSvc.cpp
-   . From Sajan EASO - Fix usage of terms "Regions" and "Region" where 
-     there was a mismatch between the value and what found in the XML 
-   . Use msg instead of log (and endmsg)
-
-!======================== SimSvc v4r1 ==================================
-! 2004-08-27 - Florence RANJARD
- - SimulationSvc.cpp - fix for WIN32
-
-! 2004-08-02 - Gloria CORTI
- - SimulationSvc.{h,cpp}
-   . use InterfaceID instead of IID to adapt to Gaudi v16
-
-!======================== SimSvc v4r0 ==================================
-! 2003-12-10 - Florence RANJARD
- - SimSvc_dll.cpp - use LOAD_FACTORY_ENTRIES macro
-
-!============================ SimSvc v3r2 ============================
-! 2003-07-07 - Florence RANJARD
- - fix for gcc3.2 (S.Ponce)
-
-!========================== SimSvc v3r1 ===========================
-! 2003-07-04 - Florence Ranjard
- - Simulation.h - comment 2 lines introduced to compile on W2000 but create
-                  a segmentation faiult on Linux when finalizing SimSvc.
-
-! 2003-07-01 - Florence RANJARD
- - Simulation.cpp - adapt to Xerces 2.2
-
-!========================== SimSvc v3r0 ============================
-
-! 2003-04-04 - Witek Pokorski
- - major change, added handling of cuts per region
-
-! 2003-06-02 - Witek Pokorski
- - typedef Particles changed to a more suitable name
-
-!========================== SimSvc v2r0 =============================
-
-! 2003-05-05 - Witek Pokorski
- - major change in the code, the cuts can be now specified per volume
-   and per particle; the default cuts (applicable to "all other" particles)
-   should be specified with pdg=0
-
-!========================== SimSvc v1r1 =============================
-
-! 2003-04-16 - Sebastien Ponce
- - added const keywords on the accessors
-
-!========================== SimSvc v1r0 ==============================
-
-! 2003-02-18 - Florence Ranjard
- - replace all the patterns used with the component_library one.
-
-! 2003-01-30 - Witek Pokorski
- - Added methods simAttribute and hasSimAttribute with name of the logical
-   volume as argument
-
-! 2003-01-29 - Sebastien Ponce
- - Added method hasSimAttribute to the interface
-
-! 2003-01-24 - Sebastien Ponce
- - package creation
diff --git a/Sim/SimSvc/src/SimulationSvc.cpp b/Sim/SimSvc/src/RegionsDefinitionSvc.cpp
similarity index 87%
rename from Sim/SimSvc/src/SimulationSvc.cpp
rename to Sim/SimSvc/src/RegionsDefinitionSvc.cpp
index fcfa35484f68dd99094008ce236444ad103a6c9c..5ecb6e4c22614a671dcadc3ff9fd2cec14896309 100755
--- a/Sim/SimSvc/src/SimulationSvc.cpp
+++ b/Sim/SimSvc/src/RegionsDefinitionSvc.cpp
@@ -7,9 +7,8 @@
 #include <xercesc/dom/DOMNodeList.hpp>
 
 #include "XmlTools/IXmlSvc.h"
-#include <DetDesc/ILVolume.h>
 
-#include "SimulationSvc.h"
+#include "RegionsDefinitionSvc.h"
 
 
 // -----------------------------------------------------------------------
@@ -18,7 +17,7 @@
 // -----------------------------------------------------------------------
 
 // Declaration of the Service Factory
-DECLARE_COMPONENT( SimulationSvc )
+DECLARE_COMPONENT( RegionsDefinitionSvc )
 
 
 
@@ -39,12 +38,12 @@ const std::string dom2Std (const XMLCh* domString) {
 // -----------------------------------------------------------------------
 // Standard Constructor
 // ------------------------------------------------------------------------
-SimulationSvc::SimulationSvc (const std::string& name, ISvcLocator* svc) :
+RegionsDefinitionSvc::RegionsDefinitionSvc (const std::string& name, ISvcLocator* svc) :
   Service (name, svc) {
-  declareProperty ("SimulationDbLocation", m_simDbLocation="empty" );
+  declareProperty ("RegionsDefinitionDbLocation", m_simDbLocation="empty" );
 }
 
-SimulationSvc::~SimulationSvc() 
+RegionsDefinitionSvc::~RegionsDefinitionSvc() 
 {
   for (AttributeSet::iterator it=m_attributeSet.begin();
        it!= m_attributeSet.end();it++)  delete (*it).second;
@@ -60,7 +59,7 @@ SimulationSvc::~SimulationSvc()
 // -----------------------------------------------------------------------
 // Initialize the service.
 // -----------------------------------------------------------------------
-StatusCode SimulationSvc::initialize() {
+StatusCode RegionsDefinitionSvc::initialize() {
   // Before anything we have to initialize grand mother
   StatusCode status = Service::initialize();
   if (!status.isSuccess()) {
@@ -69,7 +68,7 @@ StatusCode SimulationSvc::initialize() {
   if( m_simDbLocation.empty() || "empty" == m_simDbLocation ) { 
     if ( 0 != getenv("GAUSSROOT") ) {
       m_simDbLocation  = getenv("GAUSSROOT");
-      m_simDbLocation += "/xml/Simulation.xml";
+      m_simDbLocation += "/xml/RegionsDefinition.xml";
     } else {
       m_simDbLocation = "";
     }
@@ -83,7 +82,7 @@ StatusCode SimulationSvc::initialize() {
 // -----------------------------------------------------------------------
 // clear
 // ------------------------------------------------------------------------
-void SimulationSvc::clear () {
+void RegionsDefinitionSvc::clear () {
   m_attributeSet.clear();
   m_logvol2Sim.clear();
   m_regionsDefs.clear();
@@ -92,8 +91,8 @@ void SimulationSvc::clear () {
 // -----------------------------------------------------------------------
 // reload
 // ------------------------------------------------------------------------
-void SimulationSvc::reload () {
-  MsgStream msg (msgSvc(), "SimulationSvc");
+void RegionsDefinitionSvc::reload () {
+  MsgStream msg (msgSvc(), "RegionsDefinitionSvc");
 
   // erases the old set of attributes
   clear();
@@ -155,7 +154,7 @@ void SimulationSvc::reload () {
     double minRange = -1.0;
     if (!mASAttribute.empty()) {
       maxAllowedStep = xmlSvc->eval(mASAttribute, false);
-    }
+   }
     if (!mTRAttribute.empty()) {
       maxTrackLength = xmlSvc->eval(mTRAttribute, true);
     }
@@ -372,27 +371,11 @@ void SimulationSvc::reload () {
   xmlSvc->releaseDoc(iovDoc);
 
 }
- 
-
-// -----------------------------------------------------------------------
-//  hasSimAttribute (ILVolume*)
-// -----------------------------------------------------------------------
-bool SimulationSvc::hasSimAttribute (const ILVolume* vol) const {
-  if (0 != vol) {
-    // try first to find an attribute associated directly to the logical volume
-    std::string bnn = vol->name();
-    Dict::const_iterator it = m_logvol2Sim.find (bnn);
-    if (it != m_logvol2Sim.end()) {
-      return true;
-    }    
-  }
-  return false;
-}
 
 // -----------------------------------------------------------------------
 //  hasSimAttribute (std::string)
 // -----------------------------------------------------------------------
-bool SimulationSvc::hasSimAttribute (const std::string volname) const {
+bool RegionsDefinitionSvc::hasSimAttribute (const std::string volname) const {
 
   // try first to find an attribute associated directly to the logical volume
   Dict::const_iterator it = m_logvol2Sim.find (volname);
@@ -402,36 +385,11 @@ bool SimulationSvc::hasSimAttribute (const std::string volname) const {
   return false;
 }
 
-// -----------------------------------------------------------------------
-//  simAttribute (ILVolume*)
-// -----------------------------------------------------------------------
-const SimulationSvc::PartAttr*
-SimulationSvc::simAttribute (const ILVolume* vol) const {
-  PartAttr* part = 0;
-  
-  if (0 != vol) {
-    // try first to find an attribute associated directly to the logical volume
-    std::string bnn = vol->name();
-    Dict::const_iterator it = m_logvol2Sim.find (bnn);
-    if (it != m_logvol2Sim.end()) 
-      {
-        part=it->second;
-      } 
-    else 
-      {
-        MsgStream msg (msgSvc(), name());
-        msg << MSG::WARNING << "No SimAttribute for " 
-            << vol->name() << endmsg;
-      } 
-  }
-  return part;
-}
-
 // -----------------------------------------------------------------------
 //  simAttribute (std::string)
 // -----------------------------------------------------------------------
-const SimulationSvc::PartAttr*
-SimulationSvc::simAttribute (std::string volname) const {
+const RegionsDefinitionSvc::PartAttr*
+RegionsDefinitionSvc::simAttribute (std::string volname) const {
   PartAttr* part = 0;
   
   // try first to find an attribute associated directly to the logical volume
@@ -453,7 +411,7 @@ SimulationSvc::simAttribute (std::string volname) const {
 // regionsDefs()
 //------------------------------------------------------------------------
 
-const std::vector<RegionCuts>* SimulationSvc::regionsDefs () const
+const std::vector<RegionCuts>* RegionsDefinitionSvc::regionsDefs () const
 {
   return &m_regionsDefs;
 }
@@ -463,9 +421,9 @@ const std::vector<RegionCuts>* SimulationSvc::regionsDefs () const
 // Query interface
 // -----------------------------------------------------------------------
 StatusCode
-SimulationSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
-  if (IID_ISimulationSvc.versionMatch(riid))  {
-    *ppvInterface = (ISimulationSvc*)this;
+RegionsDefinitionSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
+  if (IID_IRegionsDefinitionSvc.versionMatch(riid))  {
+    *ppvInterface = (IRegionsDefinitionSvc*)this;
   } else {
     // Interface is not directly availible: try out a base class
     return Service::queryInterface(riid, ppvInterface);
diff --git a/Sim/SimSvc/src/SimulationSvc.h b/Sim/SimSvc/src/RegionsDefinitionSvc.h
similarity index 72%
rename from Sim/SimSvc/src/SimulationSvc.h
rename to Sim/SimSvc/src/RegionsDefinitionSvc.h
index f7bc5486b17ecc68353e11e137f0c4d7f8bf1e27..3b601569f3fea91814e486ccb5c9d11904fd2161 100755
--- a/Sim/SimSvc/src/SimulationSvc.h
+++ b/Sim/SimSvc/src/RegionsDefinitionSvc.h
@@ -1,28 +1,23 @@
-#ifndef SIMSVC_SIMULATIONSVC_H
-#define SIMSVC_SIMULATIONSVC_H
-
+#pragma once
 // Include files
 #include "GaudiKernel/Service.h"
 
-#include "SimSvc/ISimulationSvc.h"
+#include "GiGaMTRegions/IRegionsDefinitionSvc.h"
 
 #include <map>
 
-// Forward and external declarations
-template <class TYPE> class SvcFactory;
-
 
-/** @class SimulationSvc SimulationSvc.h SimDesc/SimulationSvc.h
+/** @class RegionsDefinitionSvc RegionsDefinitionSvc.h SimDesc/RegionsDefinitionSvc.h
  *
- *  this interface defines a Simulation service that is able to answer
+ *  this interface defines a RegionsDefinition service that is able to answer
  *  many question concerning the simulation of the detector. It
  *  is able to associate simulation attributes to logical volumes.
  *  These describe the way these volumes should be simulated
  *
  * @author Sebastien Ponce
  */
-class SimulationSvc : public Service,
-                      virtual public ISimulationSvc {
+class RegionsDefinitionSvc : public Service,
+                      virtual public IRegionsDefinitionSvc {
 public:
 
   /**
@@ -30,12 +25,12 @@ public:
    * @param name   String with service name
    * @param svc    Pointer to service locator interface
    */
-  SimulationSvc (const std::string& name, ISvcLocator* svc);
+  RegionsDefinitionSvc (const std::string& name, ISvcLocator* svc);
 
   /**
    * default destructor
    */
-  virtual ~SimulationSvc();
+  virtual ~RegionsDefinitionSvc();
 
   //  inline void operator delete (void* p) throw()
   // { operator delete( const_cast<void*> (p)) ; }
@@ -55,18 +50,9 @@ public:
   StatusCode queryInterface (const InterfaceID& riid, void** ppvInterface) override;
 
   ///////////////////////////////////////////////////////
-  // implementation of the ISimulationSvc interface //
+  // implementation of the IRegionsDefinitionSvc interface //
   ///////////////////////////////////////////////////////
 
-  /**
-   * This method returns the simulation attribute associated to a given
-   * logical volume
-   * @param vol the logical volume
-   * @return the simulation attribute that should be used to simulate
-   * this logical volume
-   */
-  const PartAttr* simAttribute (const ILVolume* vol) const override;
-
   /**
    * This method returns the simulation attribute associated to a given
    * logical volume
@@ -76,13 +62,6 @@ public:
    */
   const PartAttr* simAttribute (const std::string volname) const override;
 
-  /**
-   * This method tells whether a simulation attribute is associated to a given
-   * logical volume or not
-   * @param vol the logical volume
-   */
-  bool hasSimAttribute (const ILVolume* vol) const override;
-
   /**
    * This method tells whether a simulation attribute is associated to a given
    * logical volume or not
@@ -146,5 +125,3 @@ private:
   std::string m_simDbLocation;
 
 };
-
-#endif // SIMSVC_SIMULATIONSVC_H
diff --git a/VP/.gaudi_project_ignore b/VP/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Velo/VeloGauss/src/VeloGaussMoni.cpp b/Velo/VeloGauss/src/VeloGaussMoni.cpp
index 0efa10ae6bd25ea98ed47f69a6d46b3593425c30..90e568dd78db327b8d5f4f0960b74cf90e336f86 100755
--- a/Velo/VeloGauss/src/VeloGaussMoni.cpp
+++ b/Velo/VeloGauss/src/VeloGaussMoni.cpp
@@ -8,88 +8,45 @@
 // from LHcb
 #include "Event/MCParticle.h"
 
-// velo
-#include "VeloDet/DeVelo.h"
-
 // local
 #include "VeloGaussMoni.h"
 
-//-----------------------------------------------------------------------------
-// Implementation file for class : VeloGaussMoni
-//
-// 2005-12-13 : Tomasz Szumlak & Chris Parkes
-//-----------------------------------------------------------------------------
+// from AIDA
+#include "AIDA/IHistogram1D.h"
+#include "AIDA/IHistogram2D.h"
 
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( VeloGaussMoni )
 
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-VeloGaussMoni::VeloGaussMoni( const std::string& name,
-                              ISvcLocator* pSvcLocator)
-  : GaudiTupleAlg ( name , pSvcLocator ),
-    m_veloDetLocation ( DeVeloLocation::Default ),
-    m_veloMCHits ( ),
-    m_veloPileUpMCHits ( ),
-    m_print ( 0 ),
-    m_printInfo (false),
-    m_detailedMonitor ( true ),
-    m_testMCHit ( true ),
-    m_testPileUpMCHit ( true ),
-    m_nMCH ( 0. ),
-    m_nMCH2 ( 0. ),
-    m_nPUMCH ( 0. ),
-    m_nPUMCH2 ( 0. ),
-    m_nEvent ( 0 )
-{
-  declareProperty("Print", m_print);
-  declareProperty("PrintInfo", m_printInfo);
-  declareProperty("TestMCHit", m_testMCHit);
-  declareProperty("TestPileUpMCHit", m_testPileUpMCHit);
-  declareProperty("DetailedMonitor", m_detailedMonitor);
-  declareProperty("VeloDetLocation", m_veloDetLocation);
-  declareProperty("VeloMCHits" , 
-                  m_veloMCHitsLocation = LHCb::MCHitLocation::Velo ) ;
-  declareProperty("PuVetoMCHits" , 
-                  m_puVetoMCHitsLocation = LHCb::MCHitLocation::PuVeto ) ;
-}
-//=============================================================================
-// Destructor
-//=============================================================================
-VeloGaussMoni::~VeloGaussMoni() {}
-
 //=============================================================================
 // Initialization
 //=============================================================================
 StatusCode VeloGaussMoni::initialize() {
-  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
+  StatusCode sc = GaudiHistoAlg::initialize(); // must be executed first
   if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
 
   debug() << "==> Initialize" << endmsg;
   //
   m_veloDet=( getDet<DeVelo>(m_veloDetLocation ) );
   setHistoTopDir("Velo/");
+  bookHistograms();
+  checkTests();
   //
   return StatusCode::SUCCESS;
 }
 
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode VeloGaussMoni::execute() {
+
+void VeloGaussMoni::operator()(const LHCb::MCHits& m_veloMCHits, const LHCb::MCHits& m_veloPileUpMCHits) const{
 
   debug() << "==> Execute" << endmsg;
   //
+  //FIXME: Cannot have the threads interfere with each others plotting
+  //so instead of doing something smart we just lock this for now ...
+  std::lock_guard<std::mutex> guard_lock(m_lazy_lock);
   m_nEvent++;
-  getData();
-  if(m_testMCHit) veloMCHitMonitor();
-  if(m_testPileUpMCHit) veloPileUpMCHitMonitor();
-  if(!m_detailedMonitor) basicMonitor();
-  checkTests();
-  //
-  return StatusCode::SUCCESS;
+  if(m_testMCHit) veloMCHitMonitor(&m_veloMCHits);
+  if(m_testPileUpMCHit) veloPileUpMCHitMonitor(&m_veloPileUpMCHits);
 }
 
 //=============================================================================
@@ -98,76 +55,42 @@ StatusCode VeloGaussMoni::execute() {
 StatusCode VeloGaussMoni::finalize() {
 
   debug() << "==> Finalize" << endmsg;  
-  m_nMCH/=m_nEvent;
-  m_nMCH2/=m_nEvent;
-  double err_nMCH=sqrt((m_nMCH2-(m_nMCH*m_nMCH))/m_nEvent);
-  m_nPUMCH/=m_nEvent;
-  m_nPUMCH2/=m_nEvent;
-  double err_nPUMCH=sqrt((m_nPUMCH2-(m_nPUMCH*m_nPUMCH))/m_nEvent);
+  double ave_nMCH = (double) m_nMCH / m_nEvent;
+  double ave_nMCH2 = (double) m_nMCH2 / m_nEvent;
+  double err_nMCH=sqrt((ave_nMCH2-(ave_nMCH*ave_nMCH))/m_nEvent);
+  double ave_nPUMCH = (double) m_nPUMCH / m_nEvent;
+  double ave_nPUMCH2 = (double)m_nPUMCH2 / m_nEvent;
+  double err_nPUMCH=sqrt((ave_nPUMCH2-(ave_nPUMCH*ave_nPUMCH))/m_nEvent);
   //
   info()<< "------------------------------------------------------" <<endmsg;
   info()<< "                - VeloGaussMoni table -                 " <<endmsg;
   info()<< "------------------------------------------------------" <<endmsg;
   if(m_nMCH>0){
-    info()<< "| Number of MCHits/Event:       " << m_nMCH << "+/-"
+    info()<< "| Number of MCHits/Event:       " << ave_nMCH << "+/-"
           << err_nMCH <<endmsg;
-    info()<< "| Number of PileUpMCHits/Event: " << m_nPUMCH << "+/-"
+    info()<< "| Number of PileUpMCHits/Event: " << ave_nPUMCH << "+/-"
           << err_nPUMCH <<endmsg;
   }else{
     info()<< "| ==> No MCHits found! " <<endmsg;
   }
   info()<< "------------------------------------------------------" <<endmsg;
   //
-  return GaudiAlgorithm::finalize();  // must be called after all other actions
+  return GaudiHistoAlg::finalize();  // must be called after all other actions
 }
-//
-StatusCode VeloGaussMoni::getData()
-{
-  debug()<< " ==> VeloGaussMoni::getData" <<endmsg;
 
-  if(!exist<LHCb::MCHits>( m_veloMCHitsLocation )){
-    error()<< "There is no MCHits at MC/Velo/Hits in TES!" <<endmsg;
-    m_testMCHit=false;
-  }else{
-    m_veloMCHits=get<LHCb::MCHits>( m_veloMCHitsLocation );
-  }
-  //
-  if(!exist<LHCb::MCHits>( m_puVetoMCHitsLocation )){
-    error()<< "There is no MCHits at MC/PuVeto/Hits in TES!" <<endmsg;
-    m_testPileUpMCHit=false;
-  }else{
-    m_veloPileUpMCHits=get<LHCb::MCHits>( m_puVetoMCHitsLocation );
-  }
-  //  
-  if(m_printInfo){
-    info()<< "----------------------------------------------------" <<endmsg;
-    if(m_testMCHit)
-      info()<< " ==> Number of MCHits found in Velo Detector: "
-            << m_veloMCHits->size() <<endmsg;
-    if(m_testPileUpMCHit)
-      info()<< " ==> Number of Pile Up MCHits found in Velo Detector: "
-            << m_veloPileUpMCHits->size() <<endmsg;
-    info()<< "---------------------------------------------------" <<endmsg;
-  }
-  //
-  return StatusCode::SUCCESS;
-}
 //
-StatusCode VeloGaussMoni::veloMCHitMonitor()
+StatusCode VeloGaussMoni::veloMCHitMonitor(const LHCb::MCHits * m_veloMCHits) const
 {
   debug()<< " ==> VeloGaussMoni::VeloMCHitMonitor " <<endmsg;
   //
-  double size=m_veloMCHits->size();
+  auto size=m_veloMCHits->size();
   m_nMCH+=size;
   m_nMCH2+=size*size;
   //
-  plot(size, "nMCHits", 
-       "Number of hits in Velo per event",
-       0., 3000., 100);
+  m_hist_nMCHits->fill(size);
   //
-  LHCb::MCHits::iterator It;
   // loop over all MCHits stored into the container
-  for(It=m_veloMCHits->begin(); It!=m_veloMCHits->end(); It++){
+  for(auto It=m_veloMCHits->begin(); It!=m_veloMCHits->end(); It++){
     if(m_printInfo){
       info()<< " ==> Test MCHit: \n"
             << " sensor: " << ((*It)->sensDetID())
@@ -183,28 +106,16 @@ StatusCode VeloGaussMoni::veloMCHitMonitor()
     }
     //
     if(m_detailedMonitor){
-    plot((*It)->energy()/Gaudi::Units::eV, "eDepSi",
-         "Energy deposited in Si [eV]",
-         0., 300000., 100);
-    plot2D((*It)->entry().z()/Gaudi::Units::cm,
-           (*It)->entry().x()/Gaudi::Units::cm, "entryZX",
-           "Particle entry point in Si [cm] - ZX plane",
-           -20., 80., -5., 5., 1000, 50);
-    plot2D((*It)->entry().x()/Gaudi::Units::cm,
-           (*It)->entry().y()/Gaudi::Units::cm, "entryXY",
-           "Particle entry point in Si [cm] - XY plane",
-           -5., 5., -5., 5., 50, 50);
-    plot2D((*It)->exit().z()/Gaudi::Units::cm,
-           (*It)->exit().x()/Gaudi::Units::cm, "exitZX",
-           "Particle exit point in Si [cm] - ZX plane",
-           -20., 80., -5., 5., 1000, 50);
-    plot2D((*It)->exit().x()/Gaudi::Units::cm,
-           (*It)->exit().y()/Gaudi::Units::cm, "exitXY",
-           "Particle exit point in Si [cm] - XY plane",
-           -5., 5., -5., 5., 50, 50);
-    plot((*It)->time()/Gaudi::Units::ns, "TOF",
-         "Time Of Flight [ns]", 
-         0., 50., 100);
+    m_hist_eDepSi->fill((*It)->energy()/Gaudi::Units::eV);
+    m_hist_entryZX->fill((*It)->entry().z()/Gaudi::Units::cm,
+           (*It)->entry().x()/Gaudi::Units::cm);
+    m_hist_entryXY->fill((*It)->entry().x()/Gaudi::Units::cm,
+           (*It)->entry().y()/Gaudi::Units::cm);
+    m_hist_exitZX->fill((*It)->exit().z()/Gaudi::Units::cm,
+           (*It)->exit().x()/Gaudi::Units::cm);
+    m_hist_exitXY->fill((*It)->exit().x()/Gaudi::Units::cm,
+           (*It)->exit().y()/Gaudi::Units::cm);
+    m_hist_TOF->fill((*It)->time()/Gaudi::Units::ns);
     //
     const DeVeloSensor* sensor=m_veloDet->sensor((*It)->sensDetID());
     double x=(*It)->entry().x()/Gaudi::Units::cm;
@@ -213,40 +124,24 @@ StatusCode VeloGaussMoni::veloMCHitMonitor()
     //
     if(sensor->isRight()){
       if(sensor->isR()){
-        plot2D(x, y, "entryRRXY",
-               "Particle entry point in RRight [cm] - XY plane",
-               -5., 5., -5., 5., 50, 50);
-        plot2D(z, x, "entryRRZX",
-               "Particle entry point in RRight [cm] - ZX plane",
-               -20., 80., -5., 5., 1000, 50);
+        m_hist_entryRRXY->fill(x, y);
+        m_hist_entryRRZX->fill(z, x);
       }else if(sensor->isPhi()){
         if(sensor->isDownstream()){
-          plot2D(x, y, "entryPDRXY",
-                 "Particle entry point in PhiDR [cm] - XY plane",
-                 -5., 5., -5., 5., 50, 50);
+          m_hist_entryPDRXY->fill(x, y);
         }else{
-          plot2D(x, y, "entryPURXY",
-                 "Particle entry point in PhiUR [cm] - XY plane",
-                 -5., 5., -5., 5., 50, 50);
+          m_hist_entryPURXY->fill(x, y);
         }
       }
     }else{
       if(sensor->isR()){
-        plot2D(x, y, "entryRLXY",
-               "Particle entry point in RLeft [cm] - XY plane",
-               -5., 5., -5., 5., 50, 50);
-        plot2D(z, x, "entryRLZX",
-               "Particle entry point in RLeft [cm] - ZX plane",
-               -20, 80, -5., 5., 1000, 50);
+        m_hist_entryRLXY->fill(x, y);
+        m_hist_entryRLZX->fill(z, x);
       }else if(sensor->isPhi()){
         if(sensor->isDownstream()){
-          plot2D(x, y, "entryPDLXY",
-                 "Particle entry point in PhiDR [cm] - XY plane",
-                 -5., 5., -5., 5., 50, 50);
+          m_hist_entryPDLXY->fill(x, y);
         }else{    
-          plot2D(x, y, "entryPULXY",
-                 "Particle entry point in PhiUL [cm] - XY plane",
-                 -5., 5., -5., 5., 50, 50);
+          m_hist_entryPULXY->fill(x, y);
        }
       }
      }
@@ -255,9 +150,7 @@ StatusCode VeloGaussMoni::veloMCHitMonitor()
     const LHCb::MCParticle* myMCParticle=(*It)->mcParticle();
     if(0!=myMCParticle){
       Gaudi::LorentzVector fMom=myMCParticle->momentum();
-      plot(fMom.e()/Gaudi::Units::GeV, "eMCPart",
-           "Particle energy [GeV]",
-           0., 50., 100);        
+      m_hist_eMCPart->fill(fMom.e()/Gaudi::Units::GeV);        
       if(m_printInfo){
         info()<< " ==> MCHit - MCParticle: "
               << "\np_x = " << fMom.px()/Gaudi::Units::GeV
@@ -270,21 +163,18 @@ StatusCode VeloGaussMoni::veloMCHitMonitor()
   return StatusCode::SUCCESS;
 }
 //
-StatusCode VeloGaussMoni::veloPileUpMCHitMonitor()
+StatusCode VeloGaussMoni::veloPileUpMCHitMonitor(const LHCb::MCHits *m_veloPileUpMCHits) const
 {
   debug()<< " ==> VeloGaussMoni::VeloPileUpMCHitMonitor " <<endmsg;
   //
-  double size=m_veloPileUpMCHits->size();
+  auto size=m_veloPileUpMCHits->size();
   m_nPUMCH+=size;
   m_nPUMCH2+=size*size;
   //
-  plot(size, "nMCPUHits",
-       "Number of PileUp hits per event",
-       0., 3000., 100);
+  m_hist_nMCPUHits->fill(size);
   //
-  LHCb::MCHits::iterator It;
   // loop over all hits sotred into the Pile Up Hits container
-  for(It=m_veloPileUpMCHits->begin(); It!=m_veloPileUpMCHits->end(); It++){
+  for(auto It=m_veloPileUpMCHits->begin(); It!=m_veloPileUpMCHits->end(); It++){
     if(m_printInfo){
       info()<< " ==> Test Pile Up MCHit: \n"
             << " sensor: " << ((*It)->sensDetID())
@@ -300,28 +190,16 @@ StatusCode VeloGaussMoni::veloPileUpMCHitMonitor()
     }
     //
     if(m_detailedMonitor){
-    plot((*It)->energy()/Gaudi::Units::eV, "eDepSiPU",
-         "PileUp: Energy deposited in Si [eV]",
-         0., 300000., 100);
-    plot2D((*It)->entry().x()/Gaudi::Units::cm,
-           (*It)->entry().y()/Gaudi::Units::cm, "entryXYPU",
-           "PileUp: Particle entry point in Si [cm] - XY plane",
-           -5., 5., -5., 5., 50, 50);
-    plot2D((*It)->entry().z()/Gaudi::Units::cm,
-           (*It)->entry().x()/Gaudi::Units::cm, "entryXYPU",
-           "PileUp: Particle entry point in Si [cm] - ZX plane",
-           -40., -10., -5., 5., 1000, 50);
-    plot2D((*It)->exit().x()/Gaudi::Units::cm,
-           (*It)->exit().y()/Gaudi::Units::cm, "exitXYPU",
-           "PileUp: Particle exit point in Si [cm] - XY plane",
-           -5., 5., -5., 5., 50, 50);
-    plot2D((*It)->exit().z()/Gaudi::Units::cm,
-           (*It)->exit().x()/Gaudi::Units::cm, "exitZXPU",
-           "PileUp: Particle exit point in Si [cm] - ZX plane",
-           -40., -10., -5., 5., 1000, 50);
-    plot((*It)->time()/Gaudi::Units::ns, "TOFPU",
-         "PileUp: Time Of Flight [ns]",
-         0., 50., 100);
+    m_hist_eDepSiPU->fill((*It)->energy()/Gaudi::Units::eV);
+    m_hist_entryXYPU->fill((*It)->entry().x()/Gaudi::Units::cm,
+           (*It)->entry().y()/Gaudi::Units::cm);
+    m_hist_entryZXPU->fill((*It)->entry().z()/Gaudi::Units::cm,
+           (*It)->entry().x()/Gaudi::Units::cm);
+    m_hist_exitXYPU->fill((*It)->exit().x()/Gaudi::Units::cm,
+           (*It)->exit().y()/Gaudi::Units::cm);
+    m_hist_exitZXPU->fill((*It)->exit().z()/Gaudi::Units::cm,
+           (*It)->exit().x()/Gaudi::Units::cm);
+    m_hist_TOFPU->fill((*It)->time()/Gaudi::Units::ns);
     }
    // get access to the MCParticle which made the hit, and write out 4-mom
    const LHCb::MCParticle* myMCParticle=(*It)->mcParticle();
@@ -343,40 +221,6 @@ StatusCode VeloGaussMoni::veloPileUpMCHitMonitor()
   return StatusCode::SUCCESS;
 }
 //
-StatusCode VeloGaussMoni::basicMonitor()
-{
-  debug()<< " ==> VeloGaussMoni::basicMonitor " <<endmsg;
-  
-  double size=0.;
-  if(m_testMCHit){
-    if(0==m_veloMCHits){
-      error()<< " -- No MCHit container retrieved! -- " <<endmsg;
-      return StatusCode::FAILURE;
-    }else{
-      debug()<< " -- Retrieved MCHit container --" <<endmsg;
-    }
-    size=m_veloMCHits->size();    
-    m_nMCH+=size;
-    m_nMCH2+=size*size;
-    plot(size, "nMCHits", "Number of MCHits per event" , 0., 3000., 100);
-  }
-  //
-  if(m_testPileUpMCHit){
-    if(0==m_veloPileUpMCHits){
-      error()<< " -- No PileUp MCHit container retrieved! -- " <<endmsg;
-      return StatusCode::FAILURE;
-    }else{
-      debug()<< " -- Retrieved PileUp MCHit container --" <<endmsg;
-    }
-    size=m_veloPileUpMCHits->size();
-    m_nPUMCH+=size;
-    m_nPUMCH2+=size*size;
-    plot(size, "nMCHitsPU", "Number of PileUp MCHits per event" , 0., 3000., 100);
-  }
-  //
-  return StatusCode::SUCCESS;
-}
-//
 StatusCode VeloGaussMoni::checkTests()
 {
   if(!(m_testMCHit||m_testPileUpMCHit)){
@@ -385,5 +229,67 @@ StatusCode VeloGaussMoni::checkTests()
   }
   //
   return StatusCode::SUCCESS;
-}   
-//=============================================================================
+}
+
+void VeloGaussMoni::bookHistograms() {
+  m_hist_nMCHits =
+      book1D("nMCHits", "Number of hits in Velo per event", 0., 3000., 100);
+  m_hist_eDepSi =
+      book("eDepSi", "Energy deposited in Si [eV]", 0., 300000., 100);
+  m_hist_TOF = book("TOF", "Time Of Flight [ns]", 0., 50., 100);
+  m_hist_entryZX =
+      book2D("entryZX", "Particle entry point in Si [cm] - ZX plane", -20., 80.,
+             1000, -5., 5., 50);
+  m_hist_entryXY =
+      book2D("entryXY", "Particle entry point in Si [cm] - XY plane", -5., 5.,
+             50, -5., 5., 50);
+  m_hist_exitZX = book2D("exitZX", "Particle exit point in Si [cm] - ZX plane",
+                         -20., 80., 1000, -5., 5., 50);
+  m_hist_exitXY = book2D("exitXY", "Particle exit point in Si [cm] - XY plane",
+                         -5., 5., 50, -5., 5., 50);
+
+  m_hist_entryRRXY =
+      book2D("entryRRXY", "Particle entry point in RRight [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+  m_hist_entryRRZX =
+      book2D("entryRRZX", "Particle entry point in RRight [cm] - ZX plane",
+             -20., 80., 1000, -5., 5., 50);
+  m_hist_entryPDRXY =
+      book2D("entryPDRXY", "Particle entry point in PhiDR [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+  m_hist_entryPURXY =
+      book2D("entryPURXY", "Particle entry point in PhiUR [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+  m_hist_entryRLXY =
+      book2D("entryRLXY", "Particle entry point in RLeft [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+  m_hist_entryRLZX =
+      book2D("entryRLZX", "Particle entry point in RLeft [cm] - ZX plane", -20,
+             80, 1000, -5., 5., 50);
+  m_hist_entryPDLXY =
+      book2D("entryPDLXY", "Particle entry point in PhiDR [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+  m_hist_entryPULXY =
+      book2D("entryPULXY", "Particle entry point in PhiUL [cm] - XY plane", -5.,
+             5., 50, -5., 5., 50);
+
+  m_hist_eMCPart = book("eMCPart", "Particle energy [GeV]", 0., 50., 100);
+
+  m_hist_nMCPUHits =
+      book1D("nMCPUHits", "PileUp: Number of hits in Velo per event", 0., 3000., 100);
+  m_hist_eDepSiPU =
+      book("eDepSiPU", "PileUp: Energy deposited in Si [eV]", 0., 300000., 100);
+  m_hist_TOFPU = book("TOFPU", "PileUp: Time Of Flight [ns]", 0., 50., 100);
+  m_hist_entryZXPU =
+      book2D("entryZXPU", "PileUp: Particle entry point in Si [cm] - ZX plane", -20., 80.,
+             1000, -5., 5., 50);
+  m_hist_entryXYPU =
+      book2D("entryXYPU", "PileUp: Particle entry point in Si [cm] - XY plane", -5., 5.,
+             50, -5., 5., 50);
+  m_hist_exitZXPU = book2D("exitZXPU", "PileUp: Particle exit point in Si [cm] - ZX plane",
+                         -20., 80., 1000, -5., 5., 50);
+  m_hist_exitXYPU = book2D("exitXYPU", "PileUp: Particle exit point in Si [cm] - XY plane",
+                         -5., 5., 50, -5., 5., 50);
+
+  m_hist_eMCPartPU = book("eMCPartPU", "PileUp: Particle energy [GeV]", 0., 50., 100);
+}
diff --git a/Velo/VeloGauss/src/VeloGaussMoni.h b/Velo/VeloGauss/src/VeloGaussMoni.h
index 5c57769d82fc1816d37e95fc1cbd7042f1f0ecf1..758baf24db97e8589f4cb1a51b8bd59d9fdecdc1 100755
--- a/Velo/VeloGauss/src/VeloGaussMoni.h
+++ b/Velo/VeloGauss/src/VeloGaussMoni.h
@@ -1,12 +1,14 @@
-// $Id: VeloGaussMoni.h,v 1.5 2009-03-26 22:02:12 robbep Exp $
-#ifndef VELOGAUSSMONI_H
-#define VELOGAUSSMONI_H 1
+#pragma once
 
 // Include files
 // from Gaudi
 #include "GaudiAlg/GaudiTupleAlg.h"
+#include "GaudiAlg/Consumer.h"
 #include "Event/MCHit.h"
 
+// velo
+#include "VeloDet/DeVelo.h"
+
 /** @class VeloGaussMoni VeloGaussMoni.h
  *
  *
@@ -18,44 +20,79 @@ class DeVelo;
 class DeVeloRType;
 class DeVeloPhiType;
 
-class VeloGaussMoni : public GaudiTupleAlg {
+class VeloGaussMoni
+    : public Gaudi::Functional::Consumer<void(
+          const LHCb::MCHits&, const LHCb::MCHits&),Gaudi::Functional::Traits::BaseClass_t<GaudiHistoAlg>> {
+//public GaudiTupleAlg {
 public:
   /// Standard constructor
-  VeloGaussMoni( const std::string& name, ISvcLocator* pSvcLocator );
-
-  virtual ~VeloGaussMoni( ); ///< Destructor
+  VeloGaussMoni( const std::string& name, ISvcLocator* pSvcLocator )
+      : Consumer(name, pSvcLocator,
+                 {{KeyValue{"VeloMCHits", LHCb::MCHitLocation::Velo},
+                   KeyValue{"PuVetoMCHits", LHCb::MCHitLocation::PuVeto} }}){};
 
   StatusCode initialize() override;    ///< Algorithm initialization
-  StatusCode execute   () override;    ///< Algorithm execution
   StatusCode finalize  () override;    ///< Algorithm finalization
 
+  void operator()(const LHCb::MCHits&, const LHCb::MCHits&) const override;
 protected:
 
   StatusCode checkTests();
-  StatusCode getData();
-  StatusCode veloMCHitMonitor();
-  StatusCode veloPileUpMCHitMonitor();
-  StatusCode basicMonitor();
+  StatusCode veloMCHitMonitor(const LHCb::MCHits *) const;
+  StatusCode veloPileUpMCHitMonitor(const LHCb::MCHits *) const;
 
 private:
 
-  std::string m_veloDetLocation;
+  void bookHistograms();
+
+  Gaudi::Property<std::string> m_veloDetLocation{this, "VeloDetLocation", DeVeloLocation::Default};
   DeVelo* m_veloDet;
   LHCb::MCHits* m_veloMCHits;
   LHCb::MCHits* m_veloPileUpMCHits;
-  int m_print;
-  bool m_printInfo;
-  bool m_detailedMonitor;
-  bool m_testMCHit;
-  bool m_testPileUpMCHit;
-  double m_nMCH;
-  double m_nMCH2;
-  double m_nPUMCH;
-  double m_nPUMCH2;
-  int m_nEvent;
+  Gaudi::Property<int> m_print{this, "Print", 0};
+  Gaudi::Property<bool> m_printInfo{this, "PrintInfo", false};
+  Gaudi::Property<bool> m_detailedMonitor{this, "DetailedMonitor", true};
+  Gaudi::Property<bool> m_testMCHit{this, "TestMCHit", true};
+  Gaudi::Property<bool> m_testPileUpMCHit{this, "TestPileupMCHit", true};
+  mutable std::atomic_ulong m_nMCH{0};
+  mutable std::atomic_ulong m_nMCH2{0};
+  mutable std::atomic_ulong m_nPUMCH{0};
+  mutable std::atomic_ulong m_nPUMCH2{0};
+  mutable std::atomic_uint m_nEvent{0};
   /// Location of Velo MCHits
   std::string m_veloMCHitsLocation ;
   /// Location of PuVeto MCHits
   std::string m_puVetoMCHitsLocation ;
+  mutable std::mutex m_lazy_lock;
+
+  AIDA::IHistogram1D* m_hist_nMCHits{nullptr};
+  AIDA::IHistogram1D* m_hist_eDepSi{nullptr};
+  AIDA::IHistogram1D* m_hist_TOF{nullptr};
+
+  AIDA::IHistogram2D* m_hist_entryZX{nullptr};
+  AIDA::IHistogram2D* m_hist_entryXY{nullptr};
+  AIDA::IHistogram2D* m_hist_exitZX{nullptr};
+  AIDA::IHistogram2D* m_hist_exitXY{nullptr};
+
+  AIDA::IHistogram2D* m_hist_entryRRXY{nullptr};
+  AIDA::IHistogram2D* m_hist_entryRRZX{nullptr};
+  AIDA::IHistogram2D* m_hist_entryPDRXY{nullptr};
+  AIDA::IHistogram2D* m_hist_entryPURXY{nullptr};
+  AIDA::IHistogram2D* m_hist_entryRLXY{nullptr};
+  AIDA::IHistogram2D* m_hist_entryRLZX{nullptr};
+  AIDA::IHistogram2D* m_hist_entryPDLXY{nullptr};
+  AIDA::IHistogram2D* m_hist_entryPULXY{nullptr};
+
+  AIDA::IHistogram1D* m_hist_eMCPart{nullptr};
+
+  AIDA::IHistogram1D* m_hist_nMCPUHits{nullptr};
+  AIDA::IHistogram1D* m_hist_eDepSiPU{nullptr};
+  AIDA::IHistogram1D* m_hist_TOFPU{nullptr};
+
+  AIDA::IHistogram2D* m_hist_entryZXPU{nullptr};
+  AIDA::IHistogram2D* m_hist_entryXYPU{nullptr};
+  AIDA::IHistogram2D* m_hist_exitZXPU{nullptr};
+  AIDA::IHistogram2D* m_hist_exitXYPU{nullptr};
+
+  AIDA::IHistogram1D* m_hist_eMCPartPU{nullptr};
 };
-#endif // VELOGAUSSMONI_H
diff --git a/Vis/.gaudi_project_ignore b/Vis/.gaudi_project_ignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generators_versions.txt b/generators_versions_LCG95.txt
similarity index 100%
rename from generators_versions.txt
rename to generators_versions_LCG95.txt
diff --git a/generators_versions_LCG96.txt b/generators_versions_LCG96.txt
new file mode 100644
index 0000000000000000000000000000000000000000..be3003968910f2fbc0ffbd17319977d9ff81fc4d
--- /dev/null
+++ b/generators_versions_LCG96.txt
@@ -0,0 +1,14 @@
+alpgen         2.1.4
+herwig++       2.7.1
+hijing         1.383bs.2
+lhapdf         6.2.3
+photos++       3.56
+powheg-box-v2  r3043.lhcb
+pythia6        427.2
+pythia8        240
+rivet          2.7.2b
+tauola++       1.1.6b.lhcb
+thepeg         2.1.5
+crmc           1.5.6
+yoda           1.7.5
+starlight      r300
diff --git a/generators_versions_LCG96b.txt b/generators_versions_LCG96b.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9b6459b47d02ef740daed4c81273db68d2ea9186
--- /dev/null
+++ b/generators_versions_LCG96b.txt
@@ -0,0 +1,14 @@
+alpgen         2.1.4
+herwig++       2.7.1
+hijing         1.383bs.2
+lhapdf         6.2.3
+photos++       3.56
+powheg-box-v2  r3043.lhcb
+pythia6        427.2
+pythia8        240
+rivet          2.7.2b
+tauola++       1.1.6b.lhcb
+thepeg         2.1.5
+crmc           1.5.6
+yoda           1.7.7
+starlight      r300
diff --git a/toolchain.cmake b/toolchain.cmake
index c4021cdc129ac467c7532389110eea93ebceed9f..6ab1c3e118c0a2fe20206f91d62b16d3f2aae51f 100644
--- a/toolchain.cmake
+++ b/toolchain.cmake
@@ -5,12 +5,6 @@ cmake_minimum_required(VERSION 3.6)
 
 find_file(inherit_heptools_module InheritHEPTools.cmake)
 
-if(EXISTS ${CMAKE_SOURCE_DIR}/generators_versions.txt)
-  file(READ ${CMAKE_SOURCE_DIR}/generators_versions.txt generators_versions)
-  string(REGEX REPLACE "[ \t\n]+" ";" generators_versions "${generators_versions}")
-  set(generators_versions ${generators_versions})
-endif()
-
 # Process the lines of LCG_generators_*.txt file to extract the
 # needed generators (variable generators_versions)
 macro(lcg_set_generator root name hash version dir)
@@ -75,6 +69,12 @@ if(inherit_heptools_module)
   include(${inherit_heptools_module})
   inherit_heptools()
 
+  if(EXISTS ${CMAKE_SOURCE_DIR}/generators_versions_LCG${heptools_version}.txt)
+    file(READ ${CMAKE_SOURCE_DIR}/generators_versions_LCG${heptools_version}.txt generators_versions)
+    string(REGEX REPLACE "[ \t\n]+" ";" generators_versions "${generators_versions}")
+    set(generators_versions ${generators_versions})
+  endif()
+
   if(LCG_TOOLCHAIN_INFO)
     # prepare list of toolchain info files for generators
     get_filename_component(_info_name ${LCG_TOOLCHAIN_INFO} NAME CACHE)