diff --git a/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.cc b/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.cc index cfad3cfd3..6952a8abe 100644 --- a/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.cc +++ b/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.cc @@ -20,15 +20,37 @@ void CalorimeterHitToTrackerHit::process( const auto [calorimeter_hits] = input; auto [tracker_hits] = output; - for (const auto &calorimeter_hit: *calorimeter_hits) { - - edm4eic::CovDiag3f position_error; - - [[maybe_unused]] - auto tracker_hit = tracker_hits->create( + for (const auto& calorimeter_hit: *calorimeter_hits) { + + // Get CellID + auto cell_id{calorimeter_hit.getCellID()}; + + // Determine detector element + auto det_element = m_volume_manager.lookupDetElement(cell_id); + + // Cache position errors for detector elements + static std::map position_error; + if (position_error.count(det_element) == 0) { + + // Determine readout and segmentation + auto readout = m_converter->findReadout(det_element); + auto segmentation = readout.segmentation(); + + // Determine position uncertainty + if (segmentation.type() == "CartesianGridXY") { + auto cell_dimensions = m_converter->cellDimensions(cell_id); + position_error[det_element].xx = cell_dimensions[0] / std::sqrt(12); + position_error[det_element].yy = cell_dimensions[1] / std::sqrt(12); + } else { + continue; + } + } + + // Create tracker hit + tracker_hits->create( calorimeter_hit.getCellID(), calorimeter_hit.getPosition(), - position_error, + position_error[det_element], calorimeter_hit.getTime(), calorimeter_hit.getTimeError(), calorimeter_hit.getEnergy(), diff --git a/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.h b/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.h index 69c989091..d7023b736 100644 --- a/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.h +++ b/src/algorithms/calorimetry/CalorimeterHitToTrackerHit.h @@ -44,6 +44,7 @@ namespace eicrecon { private: const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()}; + const dd4hep::rec::CellIDPositionConverter* m_converter{algorithms::GeoSvc::instance().cellIDPositionConverter()}; const dd4hep::VolumeManager m_volume_manager{m_detector->volumeManager()}; };