Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:35:29

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 - 2025, Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <DD4hep/Detector.h>
0007 #include <DD4hep/Segmentations.h>
0008 #include <Parsers/Primitives.h>
0009 #include <algorithms/algorithm.h>
0010 #include <edm4eic/Measurement2DCollection.h>
0011 #include <edm4eic/TrackerHitCollection.h>
0012 #include <string>
0013 #include <string_view>
0014 #include <vector>
0015 
0016 #include "FarDetectorTrackerClusterConfig.h"
0017 #include "algorithms/interfaces/WithPodConfig.h"
0018 
0019 namespace eicrecon {
0020 
0021 using FarDetectorTrackerClusterAlgorithm =
0022     algorithms::Algorithm<algorithms::Input<std::vector<edm4eic::TrackerHitCollection>>,
0023                           algorithms::Output<std::vector<edm4eic::Measurement2DCollection>>>;
0024 
0025 class FarDetectorTrackerCluster : public FarDetectorTrackerClusterAlgorithm,
0026                                   public WithPodConfig<FarDetectorTrackerClusterConfig> {
0027 
0028 public:
0029   FarDetectorTrackerCluster(std::string_view name)
0030       : FarDetectorTrackerClusterAlgorithm{name,
0031                                            {"inputHitCollection"},
0032                                            {"outputClusterPositionCollection"},
0033                                            "Simple weighted clustering of hits by x-y component of "
0034                                            "single detector element segmentation"} {}
0035 
0036   /** One time initialization **/
0037   void init() final;
0038 
0039   /** Event by event processing **/
0040   void process(const Input&, const Output&) const final;
0041 
0042   /** Cluster hits **/
0043   void ClusterHits(const edm4eic::TrackerHitCollection&, edm4eic::Measurement2DCollection&) const;
0044 
0045 private:
0046   const dd4hep::Detector* m_detector{nullptr};
0047   const dd4hep::BitFieldCoder* m_id_dec{nullptr};
0048   dd4hep::Segmentation m_seg;
0049 
0050   int m_x_idx{0};
0051   int m_y_idx{0};
0052 };
0053 
0054 } // namespace eicrecon