File indexing completed on 2025-01-18 09:55:41
0001
0002
0003
0004 #pragma once
0005
0006 #include <DD4hep/Detector.h>
0007 #include <DD4hep/Segmentations.h>
0008 #include <DDRec/CellIDPositionConverter.h>
0009 #include <Parsers/Primitives.h>
0010 #include <algorithms/algorithm.h>
0011 #include <edm4eic/RawTrackerHitCollection.h>
0012 #include <edm4hep/TrackerHitCollection.h>
0013 #include <podio/ObjectID.h>
0014 #include <string>
0015 #include <string_view>
0016 #include <vector>
0017
0018 #include "FarDetectorTrackerClusterConfig.h"
0019 #include "algorithms/interfaces/WithPodConfig.h"
0020
0021
0022 struct FDTrackerCluster {
0023 unsigned long cellID{0};
0024 double x{0.0};
0025 double y{0.0};
0026 double energy{0.0};
0027 double time{0.0};
0028 double timeError{0.0};
0029 std::vector<podio::ObjectID> rawHits;
0030 };
0031 namespace eicrecon {
0032
0033 using FarDetectorTrackerClusterAlgorithm =
0034 algorithms::Algorithm<algorithms::Input<std::vector<edm4eic::RawTrackerHitCollection>>,
0035 algorithms::Output<std::vector<edm4hep::TrackerHitCollection>>>;
0036
0037 class FarDetectorTrackerCluster : public FarDetectorTrackerClusterAlgorithm,
0038 public WithPodConfig<FarDetectorTrackerClusterConfig> {
0039
0040 public:
0041 FarDetectorTrackerCluster(std::string_view name)
0042 : FarDetectorTrackerClusterAlgorithm{name,
0043 {"inputHitCollection"},
0044 {"outputClusterPositionCollection"},
0045 "Simple weighted clustering of hits by x-y component of "
0046 "single detector element segmentation"} {}
0047
0048
0049 void init() final;
0050
0051
0052 void process(const Input&, const Output&) const final;
0053
0054
0055 std::vector<FDTrackerCluster> ClusterHits(const edm4eic::RawTrackerHitCollection&) const;
0056
0057
0058 void ConvertClusters(const std::vector<FDTrackerCluster>&, edm4hep::TrackerHitCollection&) const;
0059
0060 private:
0061 const dd4hep::Detector* m_detector{nullptr};
0062 const dd4hep::BitFieldCoder* m_id_dec{nullptr};
0063 const dd4hep::rec::CellIDPositionConverter* m_cellid_converter{nullptr};
0064 dd4hep::Segmentation m_seg;
0065
0066 int m_x_idx{0};
0067 int m_y_idx{0};
0068 };
0069
0070 }