File indexing completed on 2026-07-08 07:41:03
0001
0002
0003
0004 #pragma once
0005
0006 #include <DD4hep/Detector.h>
0007 #include <edm4eic/EDM4eicVersion.h>
0008 #include <string>
0009
0010 #include "extensions/jana/JOmniFactory.h"
0011 #include "services/geometry/dd4hep/DD4hep_service.h"
0012 #include "services/algorithms_init/AlgorithmsInit_service.h"
0013 #include "algorithms/particle_flow/TrackClusterSubtractor.h"
0014
0015 namespace eicrecon {
0016
0017 class TrackClusterSubtractor_factory
0018 : public JOmniFactory<TrackClusterSubtractor_factory, TrackClusterSubtractorConfig> {
0019
0020 public:
0021 using AlgoT = eicrecon::TrackClusterSubtractor;
0022
0023 private:
0024 std::unique_ptr<AlgoT> m_algo;
0025
0026
0027 PodioInput<edm4eic::TrackClusterMatch> m_track_cluster_matches_input{this};
0028 PodioInput<edm4eic::Cluster> m_clusters_input{this};
0029 PodioInput<edm4eic::TrackSegment> m_track_projections_input{this};
0030
0031
0032 PodioOutput<edm4eic::Cluster> m_remnant_clusters_output{this};
0033 PodioOutput<edm4eic::Cluster> m_expected_clusters_output{this};
0034 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0035 PodioOutput<edm4eic::TrackClusterLink> m_track_expected_links_output{this};
0036 #endif
0037 PodioOutput<edm4eic::TrackClusterMatch> m_track_expected_matches_output{this};
0038
0039
0040 ParameterRef<double> m_energyFractionToSubtract{this, "energyFractionToSubtract",
0041 config().energyFractionToSubtract};
0042 ParameterRef<int32_t> m_defaultPDG{this, "defaultPDG", config().defaultPDG};
0043 ParameterRef<uint8_t> m_surfaceToUse{this, "surfaceToUse", config().surfaceToUse};
0044 ParameterRef<bool> m_doNSigmaCut{this, "doNSigmaCut", config().doNSigmaCut};
0045 ParameterRef<uint32_t> m_nSigmaMax{this, "nSigmaMax", config().nSigmaMax};
0046 ParameterRef<double> m_trackResolution{this, "trackResolution", config().trackResolution};
0047 ParameterRef<double> m_calorimeterResolution{this, "calorimeterResolution",
0048 config().calorimeterResolution};
0049
0050
0051 Service<AlgorithmsInit_service> m_algoInitSvc{this};
0052
0053 public:
0054 void Configure() {
0055 m_algo = std::make_unique<AlgoT>(GetPrefix());
0056 m_algo->applyConfig(config());
0057 m_algo->init();
0058 }
0059
0060 void Process(int32_t , uint64_t ) {
0061 m_algo->process(
0062 {m_track_cluster_matches_input(), m_clusters_input(), m_track_projections_input()},
0063 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0064 {
0065 m_remnant_clusters_output().get(), m_expected_clusters_output().get(),
0066 m_track_expected_links_output().get(), m_track_expected_matches_output().get()
0067 }
0068 #else
0069 {m_remnant_clusters_output().get(), m_expected_clusters_output().get(),
0070 m_track_expected_matches_output().get()}
0071 #endif
0072 );
0073 }
0074 };
0075
0076 }