File indexing completed on 2025-02-22 10:33:27
0001
0002
0003
0004 #include "services/geometry/dd4hep/DD4hep_service.h"
0005
0006
0007 #include <edm4eic/TrackSegmentCollection.h>
0008 #include <edm4eic/TrackSegment.h>
0009 #include <algorithms/fardetectors/FarDetectorLinearTracking.h>
0010
0011 #include <extensions/jana/JOmniFactory.h>
0012 #include <spdlog/logger.h>
0013
0014 namespace eicrecon {
0015
0016 class FarDetectorLinearTracking_factory :
0017 public JOmniFactory<FarDetectorLinearTracking_factory, FarDetectorLinearTrackingConfig> {
0018
0019 public:
0020 using AlgoT = eicrecon::FarDetectorLinearTracking;
0021 private:
0022 std::unique_ptr<AlgoT> m_algo;
0023
0024 VariadicPodioInput<edm4hep::TrackerHit> m_hits_input {this};
0025 PodioOutput<edm4eic::TrackSegment> m_tracks_output {this};
0026
0027 ParameterRef<int> n_layer {this, "numLayers", config().n_layer };
0028 ParameterRef<int> layer_hits_max {this, "layerHitsMax", config().layer_hits_max };
0029 ParameterRef<float> chi2_max {this, "chi2Max", config().chi2_max };
0030
0031 public:
0032 void Configure() {
0033 m_algo = std::make_unique<AlgoT>(GetPrefix());
0034 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0035 m_algo->applyConfig(config());
0036 m_algo->init();
0037 }
0038
0039 void ChangeRun(int64_t run_number) {
0040 }
0041
0042 void Process(int64_t run_number, uint64_t event_number) {
0043
0044 try {
0045 std::vector<gsl::not_null<const edm4hep::TrackerHitCollection*>> hits;
0046 for( const auto& hit : m_hits_input() ) {
0047 hits.push_back(gsl::not_null<const edm4hep::TrackerHitCollection*>{hit});
0048 }
0049
0050 m_algo->process(hits, {m_tracks_output().get()});
0051 }
0052 catch(std::exception &e) {
0053 throw JException(e.what());
0054 }
0055
0056 }
0057 };
0058
0059 }