Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 09:52:43

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include <DD4hep/Detector.h>
0007 #include <DD4hep/VolumeManager.h>
0008 #include <DDRec/CellIDPositionConverter.h>
0009 #include <algorithms/algorithm.h>
0010 #include <algorithms/geo.h>
0011 #include <edm4eic/CalorimeterHitCollection.h>
0012 #include <edm4eic/TrackerHitCollection.h>
0013 #include <gsl/pointers>
0014 #include <string>
0015 #include <string_view>
0016 
0017 #include "algorithms/calorimetry/CalorimeterHitToTrackerHitConfig.h"
0018 #include "algorithms/interfaces/WithPodConfig.h"
0019 
0020 namespace eicrecon {
0021 
0022 using CalorimeterHitToTrackerHitAlgorithm =
0023     algorithms::Algorithm<algorithms::Input<edm4eic::CalorimeterHitCollection>,
0024                           algorithms::Output<edm4eic::TrackerHitCollection>>;
0025 
0026 /**
0027  * @brief Convert calorimeter hits to tracker hits for tracking reconstruction
0028  *
0029  * This algorithm converts calorimeter hits into tracker hits by determining
0030  * position uncertainties from the detector segmentation. Currently supports
0031  * CartesianGridXY segmentation. The time uncertainty of the output hits is taken
0032  * from the configuration parameter timeError if positive, otherwise from the
0033  * input calorimeter hit.
0034  *
0035  * @note This algorithm uses VolumeManager::lookupDetElement() to access detector
0036  * geometry, requiring a complete DD4hep detector with properly configured detector
0037  * elements and placed volumes. The mock detector in unit tests lacks this hierarchy.
0038  * The algorithm is tested via integration tests when run with real detector geometry
0039  * (e.g., in the full CI pipeline with epic-main detector configuration).
0040  */
0041 class CalorimeterHitToTrackerHit : public CalorimeterHitToTrackerHitAlgorithm,
0042                                    public WithPodConfig<CalorimeterHitToTrackerHitConfig> {
0043 
0044 public:
0045   CalorimeterHitToTrackerHit(std::string_view name)
0046       : CalorimeterHitToTrackerHitAlgorithm{name,
0047                                             {"inputCalorimeterHitCollection"},
0048                                             {"outputTrackerHitCollection"},
0049                                             "Convert calorimeter hits into tracker hits."} {}
0050 
0051   void init() final;
0052   void process(const Input&, const Output&) const final;
0053 
0054 private:
0055   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0056   const dd4hep::rec::CellIDPositionConverter* m_converter{
0057       algorithms::GeoSvc::instance().cellIDPositionConverter()};
0058   const dd4hep::VolumeManager m_volume_manager{m_detector->volumeManager()};
0059 };
0060 
0061 } // namespace eicrecon