File indexing completed on 2025-02-22 10:33:27
0001
0002
0003
0004 #pragma once
0005
0006 #include "algorithms/fardetectors/FarDetectorTrackerCluster.h"
0007 #include "services/geometry/dd4hep/DD4hep_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009
0010 namespace eicrecon {
0011
0012 class FarDetectorTrackerCluster_factory :
0013 public JOmniFactory<FarDetectorTrackerCluster_factory, FarDetectorTrackerClusterConfig> {
0014
0015 public:
0016 using AlgoT = eicrecon::FarDetectorTrackerCluster;
0017 private:
0018 std::unique_ptr<AlgoT> m_algo;
0019
0020 VariadicPodioInput<edm4eic::RawTrackerHit> m_raw_hits_input {this};
0021 VariadicPodioOutput<edm4hep::TrackerHit> m_clustered_hits_output {this};
0022
0023 Service<AlgorithmsInit_service> m_algorithmsInit {this};
0024
0025 ParameterRef<std::string> m_readout {this, "readoutClass", config().readout};
0026 ParameterRef<std::string> m_x_field {this, "xField", config().x_field};
0027 ParameterRef<std::string> m_y_field {this, "yField", config().y_field};
0028 ParameterRef<double> m_hit_time_limit {this, "hitTimeLimit", config().hit_time_limit};
0029
0030 public:
0031
0032
0033 void Configure() {
0034
0035 m_algo = std::make_unique<AlgoT>(GetPrefix());
0036 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0037
0038 m_algo->applyConfig(config());
0039 m_algo->init();
0040
0041 }
0042
0043
0044 void ChangeRun(int64_t run_number) {
0045 }
0046
0047 void Process(int64_t run_number, uint64_t event_number) {
0048 std::vector<gsl::not_null<edm4hep::TrackerHitCollection*>> clustered_collections;
0049 for (const auto& clustered : m_clustered_hits_output()) {
0050 clustered_collections.push_back(gsl::not_null<edm4hep::TrackerHitCollection*>(clustered.get()));
0051 }
0052
0053 auto in1 = m_raw_hits_input();
0054 std::vector<gsl::not_null<const edm4eic::RawTrackerHitCollection*>> in2;
0055 std::copy(in1.cbegin(), in1.cend(), std::back_inserter(in2));
0056
0057
0058 m_algo->process(in2, clustered_collections);
0059 }
0060
0061 };
0062
0063 }