Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-13 10:33:05

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Derek Anderson
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include <string>
0008 
0009 #include "extensions/jana/JOmniFactory.h"
0010 #include "services/geometry/dd4hep/DD4hep_service.h"
0011 #include "services/algorithms_init/AlgorithmsInit_service.h"
0012 #include "algorithms/particle_flow/TrackClusterMergeSplitter.h"
0013 
0014 namespace eicrecon {
0015 
0016 class TrackClusterMergeSplitter_factory
0017     : public JOmniFactory<TrackClusterMergeSplitter_factory, TrackClusterMergeSplitterConfig> {
0018 
0019 public:
0020   ///! alias for algorithm name
0021   using AlgoT = eicrecon::TrackClusterMergeSplitter;
0022 
0023 private:
0024   // pointer to algorithm
0025   std::unique_ptr<AlgoT> m_algo;
0026 
0027   // input collections
0028   PodioInput<edm4eic::TrackClusterMatch> m_track_cluster_matches_input{this};
0029   PodioInput<edm4eic::Cluster> m_clusters_input{this};
0030   PodioInput<edm4eic::TrackSegment> m_track_projections_input{this};
0031 
0032   // output collections
0033   PodioOutput<edm4eic::ProtoCluster> m_protoclusters_output{this};
0034   PodioOutput<edm4eic::TrackProtoClusterLink> m_track_protocluster_links_output{this};
0035 
0036   // parameter bindings
0037   ParameterRef<double> m_minSigCut{this, "minSigCut", config().minSigCut};
0038   ParameterRef<double> m_avgEP{this, "avgEP", config().avgEP};
0039   ParameterRef<double> m_sigEP{this, "sigEP", config().sigEP};
0040   ParameterRef<double> m_drAdd{this, "drAdd", config().drAdd};
0041   ParameterRef<uint64_t> m_surfaceToUse{this, "surfaceToUse", config().surfaceToUse};
0042   ParameterRef<double> m_transverseEnergyProfileScale{this, "transverseEnergyProfileScale",
0043                                                       config().transverseEnergyProfileScale};
0044 
0045   // services
0046   Service<AlgorithmsInit_service> m_algoInitSvc{this};
0047 
0048 public:
0049   ///! Configures algorithm
0050   void Configure() {
0051     m_algo = std::make_unique<AlgoT>(GetPrefix());
0052     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0053     m_algo->applyConfig(config());
0054     m_algo->init();
0055   }
0056 
0057   ///! Primary algorithm call
0058   void Process(int32_t /*run_number*/, uint64_t /*event_number*/) {
0059     m_algo->process(
0060         {m_track_cluster_matches_input(), m_clusters_input(), m_track_projections_input()},
0061         {m_protoclusters_output().get(), m_track_protocluster_links_output().get()});
0062   }
0063 
0064 }; // end TrackClusterMergeSplitter_factory
0065 
0066 } // namespace eicrecon