From d9ff2bf973e709910b96415ce9acf857eb6e4a57 Mon Sep 17 00:00:00 2001
From: Fang Wenxing <wxfang@lxslc609.ihep.ac.cn>
Date: Mon, 15 Jun 2020 09:55:56 +0800
Subject: [PATCH] update Digi_Calo

---
 Detector/DetEcalMatrix/compact/det.xml        |   1 +
 .../src/calorimeter/EcalMatrix.cpp            |  36 ++---
 Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp  |  95 +++----------
 .../Digi_Calo/src/CaloDigiAlg.cpp_id          |  91 ------------
 .../Digi_Calo/src/CaloDigiAlg.cpp_v1          | 131 ------------------
 Reconstruction/Digi_Calo/src/CaloDigiAlg.h    |  32 -----
 6 files changed, 36 insertions(+), 350 deletions(-)
 delete mode 100644 Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_id
 delete mode 100644 Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_v1

diff --git a/Detector/DetEcalMatrix/compact/det.xml b/Detector/DetEcalMatrix/compact/det.xml
index 462dbf7a..2cd46f4f 100644
--- a/Detector/DetEcalMatrix/compact/det.xml
+++ b/Detector/DetEcalMatrix/compact/det.xml
@@ -32,6 +32,7 @@
 
   <detectors>
     <detector id="1" name="CaloDetector" type="EcalMatrix" readout="CaloHitsCollection" vis="VisibleGreen" sensitive="true">
+      <!-- Use cm as unit if you want to use Pandora for reconstruction -->
       <position x="200*cm"  y="0"  z="0"/>
       <dimensions dx="30*cm"  dy="30*cm"  dz="30*cm"/>
     </detector>
diff --git a/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp b/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
index b835f023..f12972c8 100644
--- a/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
+++ b/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
@@ -69,23 +69,23 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
               << std::endl;
 
 
-    // double cellSize_x = ::atof( seg.segmentation()->parameter("grid_size_x")->value().c_str() ) * 10;// from cm to mm
-    // double cellSize_y = ::atof( seg.segmentation()->parameter("grid_size_y")->value().c_str() ) * 10;// from cm to mm
-    // double cellSize_z = ::atof( seg.segmentation()->parameter("grid_size_z")->value().c_str() ) * 10;// from cm to mm
-    // int n_layer = int(2*dim.dx()*10/cellSize_x) ; // here the calorimeter is placed in barrel, so x direaction is layer direction
-    // std::cout<<"cellx="<<cellSize_x<<",celly="<<cellSize_y<<",cellz="<<cellSize_z<<",dx="<<dim.dx()*10<<"mm,n_layer="<<n_layer<<std::endl;
-    // for(int i=1 ; i <= n_layer; i++)
-    // {
-    //     LayeredCalorimeterData::Layer caloLayer ;
-    //     caloLayer.distance = caloData->extent[0] + (i-0.5)*cellSize_x; //NEED TO START FROM ORIGIN, to mm
-    //     caloLayer.sensitive_thickness = cellSize_x ;
-    //     caloLayer.inner_thickness = cellSize_x ;
-    //     caloLayer.outer_thickness = cellSize_x ;
-    //     caloLayer.absorberThickness = cellSize_x;
-    //     caloLayer.cellSize0 = cellSize_y;
-    //     caloLayer.cellSize1 = cellSize_z;
-    //     caloData->layers.push_back(caloLayer); 
-    // }
+    double cellSize_x = ::atof( seg.segmentation()->parameter("grid_size_x")->value().c_str() ) * 10;// from cm to mm
+    double cellSize_y = ::atof( seg.segmentation()->parameter("grid_size_y")->value().c_str() ) * 10;// from cm to mm
+    double cellSize_z = ::atof( seg.segmentation()->parameter("grid_size_z")->value().c_str() ) * 10;// from cm to mm
+    int n_layer = int(2*dim.dx()*10/cellSize_x) ; // here the calorimeter is placed in barrel, so x direaction is layer direction
+    std::cout<<"cellx="<<cellSize_x<<",celly="<<cellSize_y<<",cellz="<<cellSize_z<<",dx="<<dim.dx()*10<<"mm,n_layer="<<n_layer<<std::endl;
+    for(int i=1 ; i <= n_layer; i++)
+    {
+        LayeredCalorimeterData::Layer caloLayer ;
+        caloLayer.distance = caloData->extent[0] + (i-0.5)*cellSize_x; //NEED TO START FROM ORIGIN, to mm
+        caloLayer.sensitive_thickness = cellSize_x ;
+        caloLayer.inner_thickness = cellSize_x ;
+        caloLayer.outer_thickness = cellSize_x ;
+        caloLayer.absorberThickness = cellSize_x;
+        caloLayer.cellSize0 = cellSize_y;
+        caloLayer.cellSize1 = cellSize_z;
+        caloData->layers.push_back(caloLayer); 
+    }
 
     if ( x_det.isSensitive() )   {
         dd4hep::SensitiveDetector sd = sens;
@@ -96,7 +96,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
         phv.addPhysVolID("system",x_det.id());
     }
     sdet.setPlacement(phv);
-    // sdet.addExtension< LayeredCalorimeterData >(caloData) ; 
+    sdet.addExtension< LayeredCalorimeterData >(caloData) ; 
     MYDEBUG("create_detector DONE. ");
     return sdet;
 }
diff --git a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp b/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp
index 1370dda8..723e0e21 100644
--- a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp
+++ b/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp
@@ -8,8 +8,6 @@
 
 #include "DD4hep/Detector.h"
 #include <DD4hep/Objects.h>
-#include <DDRec/DetectorData.h>
-#include <DDRec/CellIDPositionConverter.h>
 
 
 #include <math.h>
@@ -41,77 +39,45 @@ StatusCode CaloDigiAlg::initialize()
   dd4hep::Detector* m_dd4hep = m_geosvc->lcdd();
   if ( !m_dd4hep )  throw "CaloDigiAlg :Failed to get dd4hep::Detector ...";
   m_cellIDConverter = new dd4hep::rec::CellIDPositionConverter(*m_dd4hep);
-  try{
-      const dd4hep::DetElement &detElement = m_dd4hep->detector("CaloDetector");
-      dd4hep::rec::LayeredCalorimeterData* Data = detElement.extension<dd4hep::rec::LayeredCalorimeterData>() ;
-      const std::vector<dd4hep::rec::LayeredCalorimeterData::Layer>& layerLayout = Data->layers;
-      assert(layerLayout.size()>=1);
-      m_layerLayout = &layerLayout;
-      std::cout<<"saved m_layerLayout"<<std::endl;
-  }
-  catch(...) 
-  {
-      throw "CaloDigiAlg :Failed to get LayeredCalorimeterData ...";
-  }
   return GaudiAlgorithm::initialize();
 }
 
 StatusCode CaloDigiAlg::execute()
 {
-  std::map<std::string, std::vector<edm4hep::SimCalorimeterHit> > id_vhit_map;
+  std::map<unsigned long long, edm4hep::SimCalorimeterHit> id_hit_map;
+  std::map<unsigned long long, int > test_map;
   edm4hep::CalorimeterHitCollection* caloVec   = w_DigiCaloCol.createAndPut();
   const edm4hep::SimCalorimeterHitCollection* SimHitCol =  r_SimCaloCol.get();
+  double tot_e = 0 ;
   if(SimHitCol == 0) 
   {
      std::cout<<"not found SimCalorimeterHitCollection"<< std::endl;
      return StatusCode::SUCCESS;
   }
   std::cout<<"digi, input sim hit size="<< SimHitCol->size() <<std::endl;
-  float tot_sim_en = 0;
   for( int i = 0; i < SimHitCol->size(); i++ ) 
   {
       edm4hep::SimCalorimeterHit SimHit = SimHitCol->at(i);
+      unsigned long long id = SimHit.getCellID();
       float en = SimHit.getEnergy();
-      tot_sim_en += en;
-      std::string id = GetCode(&SimHit);
-      //std::cout<<"sim i ="<< i<<",id="<< id<<",x="<<SimHit.getPosition().x<<",y="<<SimHit.getPosition().y<<",z="<<SimHit.getPosition().z <<std::endl;
-      if(id_vhit_map.find(id) != id_vhit_map.end()) id_vhit_map[id].push_back(SimHit);
-      else
-      {
-          std::vector<edm4hep::SimCalorimeterHit> vect;
-          vect.push_back(SimHit);
-          id_vhit_map[id] = vect;
-      }
+      tot_e += en;
+      test_map[id] = 1;
+      if ( id_hit_map.find(id) != id_hit_map.end()) id_hit_map[id].setEnergy(id_hit_map[id].getEnergy() + en);
+      else id_hit_map[id] = SimHit ;
   }
-  float tot_en = 0;
-  for(std::map<std::string, std::vector <edm4hep::SimCalorimeterHit> >::iterator iter = id_vhit_map.begin(); iter != id_vhit_map.end(); iter++)
+  for(std::map<unsigned long long, edm4hep::SimCalorimeterHit>::iterator iter = id_hit_map.begin(); iter != id_hit_map.end(); iter++)
   {
-    float energy = 0;
-    float x0 = 0;
-    float y0 = 0;
-    float z0 = 0;
-    for(int j=0; j < iter->second.size(); j++)
-    {
-        float hit_en = iter->second.at(j).getEnergy();
-        energy += hit_en;
-        x0     += hit_en*iter->second.at(j).getPosition().x ;
-        y0     += hit_en*iter->second.at(j).getPosition().y ;
-        z0     += hit_en*iter->second.at(j).getPosition().z ;
-    }
-    x0 = x0/energy;
-    y0 = y0/energy;
-    z0 = z0/energy;
-    edm4hep::Vector3f pos(x0, y0, z0);
-    energy = energy*m_scale;
     auto caloHit = caloVec->create();
-    //caloHit.setCellID  (iter->second.getCellID());
-    caloHit.setEnergy  (energy);
-    caloHit.setPosition(pos);
-    tot_en += caloHit.getEnergy();
+    caloHit.setCellID((iter->second).getCellID());
+    caloHit.setEnergy((iter->second).getEnergy()*m_scale);
+    dd4hep::Position position = m_cellIDConverter->position(caloHit.getCellID());
+    edm4hep::Vector3f vpos(position.x()*10, position.y()*10, position.z()*10);// cm to mm
+    caloHit.setPosition(vpos);
+    //std::cout << "sim hit id =" << caloHit.getCellID() <<",x="<<position.x()<<",y="<<position.y()<<",z="<<position.z() <<",real x="<<(iter->second).getPosition().x <<",y="<<(iter->second).getPosition().y<<",z="<<(iter->second).getPosition().z<< std::endl;
   }
     
-  std::cout<<"total sim e ="<< tot_sim_en <<std::endl;
-  std::cout<<"digi, output digi hit size="<< caloVec->size()<<",tot_en="<<tot_en <<std::endl;
+  std::cout<<"total sim e ="<< tot_e <<std::endl;
+  std::cout<<"digi, output digi hit size="<< caloVec->size() <<std::endl;
   _nEvt ++ ;
 
   return StatusCode::SUCCESS;
@@ -122,30 +88,3 @@ StatusCode CaloDigiAlg::finalize()
   info() << "Processed " << _nEvt << " events " << endmsg;
   return GaudiAlgorithm::finalize();
 }
-
-
-std::string CaloDigiAlg::GetCode(const edm4hep::SimCalorimeterHit *const pHit) const
-{
-    int layer = -1 ;   
-    for (unsigned int i = 0, iMax = m_layerLayout->size(); i < iMax; ++i)
-    {
-        const float distance(m_layerLayout->at(i).distance);
-        const float sensitive_thickness(m_layerLayout->at(i).sensitive_thickness);
-        if( (distance - 0.5*sensitive_thickness) <= pHit->getPosition().x && pHit->getPosition().x <= (distance + 0.5*sensitive_thickness)) {layer = i ; break;}
-    }
-    if(layer==-1)
-    {
-        int lmax = m_layerLayout->size()-1;
-        std::cout<<"Error BarrelLayer, set to default 1, Hit.x="<<pHit->getPosition().x<<", min_x="<<m_layerLayout->at(0).distance-0.5*m_layerLayout->at(0).sensitive_thickness<<", max_x="<<m_layerLayout->at(lmax).distance+0.5*m_layerLayout->at(lmax).sensitive_thickness<<std::endl;
-        layer = 0;
-    }
-    float cellSize0     = m_layerLayout->at(layer).cellSize0;
-    float cellSize1     = m_layerLayout->at(layer).cellSize1;
-    int cell0 = floor((pHit->getPosition().y+0.5*cellSize0)/cellSize0);
-    int cell1 = floor((pHit->getPosition().z+0.5*cellSize1)/cellSize1);
-    std::string sl = std::to_string(layer);
-    std::string s0 = std::to_string(cell0);
-    std::string s1 = std::to_string(cell1);
-    std::string id = sl+"_"+s0+"_"+s1 ;
-    return id;
-}
diff --git a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_id b/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_id
deleted file mode 100644
index e25ad95b..00000000
--- a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_id
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-#include "CaloDigiAlg.h"
-
-
-#include "edm4hep/SimCalorimeterHit.h"
-#include "edm4hep/CalorimeterHit.h"
-
-#include "DD4hep/Detector.h"
-#include <DD4hep/Objects.h>
-
-#include <cmath>
-#include <algorithm>
-
-DECLARE_COMPONENT( CaloDigiAlg )
-
-CaloDigiAlg::CaloDigiAlg(const std::string& name, ISvcLocator* svcLoc)
-  : GaudiAlgorithm(name, svcLoc),
-    _nEvt(0)
-{
-  
-  // Input collections
-  declareProperty("SimCaloHitCollection", r_SimCaloCol, "Handle of the Input SimCaloHit collection");
-  
-  // Output collections
-  declareProperty("CaloHitCollection", w_DigiCaloCol, "Handle of Digi CaloHit collection");
-  
-   
-}
-
-StatusCode CaloDigiAlg::initialize()
-{
-
-  m_geosvc = service<IGeoSvc>("GeoSvc");
-  if ( !m_geosvc )  throw "CaloDigiAlg :Failed to find GeoSvc ...";
-  dd4hep::Detector* m_dd4hep = m_geosvc->lcdd();
-  m_cellIDConverter = new dd4hep::rec::CellIDPositionConverter(*m_dd4hep);
-
-  std::cout<<"m_scale="<<m_scale<<std::endl;
-
-  return GaudiAlgorithm::initialize();
-}
-
-StatusCode CaloDigiAlg::execute()
-{
-  std::map<unsigned long long, edm4hep::SimCalorimeterHit> id_hit_map;
-  std::map<unsigned long long, int > test_map;
-  edm4hep::CalorimeterHitCollection* caloVec   = w_DigiCaloCol.createAndPut();
-  const edm4hep::SimCalorimeterHitCollection* SimHitCol =  r_SimCaloCol.get();
-  double tot_e = 0 ;
-  if(SimHitCol == 0) 
-  {
-     std::cout<<"not found SimCalorimeterHitCollection"<< std::endl;
-     return StatusCode::SUCCESS;
-  }
-  std::cout<<"digi, input sim hit size="<< SimHitCol->size() <<std::endl;
-  for( int i = 0; i < SimHitCol->size(); i++ ) 
-  {
-      edm4hep::SimCalorimeterHit SimHit = SimHitCol->at(i);
-      unsigned long long id = SimHit.getCellID();
-      /*
-      dd4hep::Position gpos(SimHit.getPosition().x, SimHit.getPosition().y, SimHit.getPosition().z);
-      long long int cell_id = m_cellIDConverter->cellID(gpos); 
-      signed long long id2 = (signed long long) SimHit.getCellID();
-      std::cout<<"sim gpos x="<<gpos.x()<<",y="<<gpos.y()<<",z="<<gpos.z()<<",id0="<<id<<",id1="<<cell_id<<",id2="<<id2<<std::endl;
-      */   
-      float en = SimHit.getEnergy();
-      tot_e += en;
-      test_map[id] = 1;
-      if ( id_hit_map.find(id) != id_hit_map.end()) id_hit_map[id].setEnergy(id_hit_map[id].getEnergy() + en);
-      else id_hit_map[id] = SimHit ;
-  }
-  for(std::map<unsigned long long, edm4hep::SimCalorimeterHit>::iterator iter = id_hit_map.begin(); iter != id_hit_map.end(); iter++)
-  {
-    auto caloHit = caloVec->create();
-    caloHit.setCellID((iter->second).getCellID());
-    caloHit.setEnergy((iter->second).getEnergy()*m_scale);
-    caloHit.setPosition((iter->second).getPosition());
-  }
-    
-  std::cout<<"total sim e ="<< tot_e <<std::endl;
-  std::cout<<"digi, output digi hit size="<< caloVec->size() <<std::endl;
-  _nEvt ++ ;
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode CaloDigiAlg::finalize()
-{
-  info() << "Processed " << _nEvt << " events " << endmsg;
-  return GaudiAlgorithm::finalize();
-}
diff --git a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_v1 b/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_v1
deleted file mode 100644
index d1d19a49..00000000
--- a/Reconstruction/Digi_Calo/src/CaloDigiAlg.cpp_v1
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-#include "CaloDigiAlg.h"
-
-
-#include "edm4hep/SimCalorimeterHit.h"
-#include "edm4hep/CalorimeterHit.h"
-#include "edm4hep/Vector3f.h"
-
-#include "DD4hep/Detector.h"
-#include <DD4hep/Objects.h>
-#include <DDRec/DetectorData.h>
-#include <DDRec/CellIDPositionConverter.h>
-
-
-#include <cmath>
-#include <algorithm>
-
-DECLARE_COMPONENT( CaloDigiAlg )
-
-CaloDigiAlg::CaloDigiAlg(const std::string& name, ISvcLocator* svcLoc)
-  : GaudiAlgorithm(name, svcLoc),
-    _nEvt(0)
-{
-  
-  // Input collections
-  declareProperty("SimCaloHitCollection", r_SimCaloCol, "Handle of the Input SimCaloHit collection");
-  
-  // Output collections
-  declareProperty("CaloHitCollection", w_DigiCaloCol, "Handle of Digi CaloHit collection");
-  
-   
-}
-
-StatusCode CaloDigiAlg::initialize()
-{
-
-  std::cout<<"CaloDigiAlg::m_scale="<<m_scale<<std::endl;
-  m_geosvc = service<IGeoSvc>("GeoSvc");
-  if ( !m_geosvc )  throw "CaloDigiAlg :Failed to find GeoSvc ...";
-  dd4hep::Detector* m_dd4hep = m_geosvc->lcdd();
-  if ( !m_dd4hep )  throw "CaloDigiAlg :Failed to get dd4hep::Detector ...";
-  m_cellIDConverter = new dd4hep::rec::CellIDPositionConverter(*m_dd4hep);
-  try{
-      const dd4hep::DetElement &detElement = m_dd4hep->detector("CaloDetector");
-      dd4hep::rec::LayeredCalorimeterData* Data = detElement.extension<dd4hep::rec::LayeredCalorimeterData>() ;
-      const std::vector<dd4hep::rec::LayeredCalorimeterData::Layer>& layerLayout = Data->layers;
-      assert(layerLayout.size()>=1);
-      float cellSize0     = layerLayout.at(0).cellSize0;
-      float cellSize1     = layerLayout.at(0).cellSize1;
-      float cellThickness = layerLayout.at(0).sensitive_thickness;
-      m_length = sqrt(cellSize0*cellSize0 + cellSize1*cellSize1 + cellThickness*cellThickness);
-      std::cout<<"CaloDigiAlg::cellSize0="<<cellSize0<<",cellSize1="<<cellSize1<<",cellThickness="<<cellThickness<<",m_length="<<m_length<<std::endl;
-  }
-  catch(...) 
-  {
-      throw "CaloDigiAlg :Failed to get LayeredCalorimeterData ...";
-  }
-  return GaudiAlgorithm::initialize();
-}
-
-StatusCode CaloDigiAlg::execute()
-{
-  std::vector< edm4hep::SimCalorimeterHit > sim_vec;
-  std::map<unsigned long long, edm4hep::SimCalorimeterHit> id_hit_map;
-  std::map<unsigned long long, int > test_map;
-  edm4hep::CalorimeterHitCollection* caloVec   = w_DigiCaloCol.createAndPut();
-  const edm4hep::SimCalorimeterHitCollection* SimHitCol =  r_SimCaloCol.get();
-  if(SimHitCol == 0) 
-  {
-     std::cout<<"not found SimCalorimeterHitCollection"<< std::endl;
-     return StatusCode::SUCCESS;
-  }
-  std::cout<<"digi, input sim hit size="<< SimHitCol->size() <<std::endl;
-  float tot_sim_en = 0;
-  for( int i = 0; i < SimHitCol->size(); i++ ) 
-  {
-      int index = -1;
-      float dis_min = m_length;//10mm*10mm*10mm
-      bool found = false;
-      edm4hep::SimCalorimeterHit SimHit = SimHitCol->at(i);
-      float en = SimHit.getEnergy();
-      tot_sim_en += en;
-      float x0 = SimHit.getPosition().x ;
-      float y0 = SimHit.getPosition().y ;
-      float z0 = SimHit.getPosition().z ;
-      //std::cout<<"x0="<<x0<<",y0="<<y0<<",z0="<<z0<<std::endl;
-      for(int j=0; j<sim_vec.size(); j++)
-      {
-          float x = sim_vec.at(j).getPosition().x ;
-          float y = sim_vec.at(j).getPosition().y ;
-          float z = sim_vec.at(j).getPosition().z ;
-          float dist  = sqrt( (x-x0)*(x-x0) + (y-y0)*(y-y0) + (z-z0)*(z-z0) );
-          if( dist < dis_min ){ dis_min = dist; index = j ; }
-      }
-      if(index==-1) sim_vec.push_back(SimHit);
-      else  
-      {   
-          float en_ori = sim_vec.at(index).getEnergy();
-          float sum_en = en + en_ori ;          
-          sim_vec.at(index).setEnergy(sum_en);
-          //std::cout<<"ori_x="<<sim_vec.at(index).getPosition().x<<",ori_y="<<sim_vec.at(index).getPosition().y<<",ori_z="<<sim_vec.at(index).getPosition().z<<std::endl;
-          float new_x = sim_vec.at(index).getPosition().x * en_ori/sum_en + SimHit.getPosition().x * en/sum_en;
-          float new_y = sim_vec.at(index).getPosition().y * en_ori/sum_en + SimHit.getPosition().y * en/sum_en;
-          float new_z = sim_vec.at(index).getPosition().z * en_ori/sum_en + SimHit.getPosition().z * en/sum_en;
-          edm4hep::Vector3f pos(new_x, new_y, new_z);
-          sim_vec.at(index).setPosition(pos);
-          //std::cout<<"new_x="<<sim_vec.at(index).getPosition().x<<",new_y="<<sim_vec.at(index).getPosition().y<<",new_z="<<sim_vec.at(index).getPosition().z<<std::endl;
-      }
-  }
-  float tot_en = 0;
-  for(std::vector< edm4hep::SimCalorimeterHit >::iterator iter = sim_vec.begin(); iter != sim_vec.end(); iter++)
-  {
-    auto caloHit = caloVec->create();
-    caloHit.setCellID  (iter->getCellID());
-    caloHit.setEnergy  (iter->getEnergy()*m_scale);
-    caloHit.setPosition(iter->getPosition());
-    tot_en += caloHit.getEnergy();
-  }
-    
-  std::cout<<"total sim e ="<< tot_sim_en <<std::endl;
-  std::cout<<"digi, output digi hit size="<< caloVec->size()<<",tot_en="<<tot_en <<std::endl;
-  _nEvt ++ ;
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode CaloDigiAlg::finalize()
-{
-  info() << "Processed " << _nEvt << " events " << endmsg;
-  return GaudiAlgorithm::finalize();
-}
diff --git a/Reconstruction/Digi_Calo/src/CaloDigiAlg.h b/Reconstruction/Digi_Calo/src/CaloDigiAlg.h
index 5ecc0f68..050ffe7b 100644
--- a/Reconstruction/Digi_Calo/src/CaloDigiAlg.h
+++ b/Reconstruction/Digi_Calo/src/CaloDigiAlg.h
@@ -13,34 +13,6 @@
 #include <DDRec/CellIDPositionConverter.h>
 #include "DetInterface/IGeoSvc.h"
 
-/** ======= PlanarDigiProcessor / CaloDigiAlg ========== <br>
- * Creates TrackerHits from SimTrackerHits, smearing them according to the input parameters. 
- * The SimTrackerHits should come from a planar detector like VXD, SIT, SET or FTD.
- * 
- * WARNING: this processor depends on correctly set CellID0s and is NOT backwards compatible to 
- * SimTrackerHit output with wrong CellID0s!!!
- * 
- * The positions of "digitized" TrackerHits are obtained by gaussian smearing positions
- * of SimTrackerHits in u and v direction. 
- * <h4>Input collections and prerequisites</h4> 
- * Processor requires a collection of SimTrackerHits <br>
- * <h4>Output</h4>
- * Processor produces collection of smeared TrackerHits<br>
- * @param SimTrackHitCollectionName The name of input collection of SimTrackerHits <br>
- * (default name VXDCollection) <br>
- * @param TrackerHitCollectionName The name of output collection of smeared TrackerHits <br>
- * (default name VTXTrackerHits) <br>
- * @param SimTrkHitRelCollection The name of the TrackerHit SimTrackerHit relation collection <br>
- * (default name VTXTrackerHitRelations) <br>
- * @param ResolutionU resolution in direction of u (in mm) <br>
- * (default value 0.004) <br>
- * @param ResolutionV Resolution in direction of v (in mm) <br>
- * (default value 0.004) <br>
- * @param IsStrip whether the hits are 1 dimensional strip measurements <br>
- * (default value false)<br>
- * <br>
- * 
- */
 
 
 
@@ -64,12 +36,8 @@ public:
    */
   virtual StatusCode finalize() ;
  
-  std::string GetCode(const edm4hep::SimCalorimeterHit *const pHit) const;
- 
 protected:
 
-  const std::vector<dd4hep::rec::LayeredCalorimeterData::Layer>* m_layerLayout;
- 
   SmartIF<IGeoSvc> m_geosvc;
   typedef std::vector<float> FloatVec;
 
-- 
GitLab