File indexing completed on 2025-07-14 08:14:42
0001
0002
0003
0004 #pragma once
0005
0006 #include "algorithms/calorimetry/CalorimeterClusterRecoCoG.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009
0010 namespace eicrecon {
0011
0012 class CalorimeterClusterRecoCoG_factory
0013 : public JOmniFactory<CalorimeterClusterRecoCoG_factory, CalorimeterClusterRecoCoGConfig> {
0014
0015 public:
0016 using AlgoT = eicrecon::CalorimeterClusterRecoCoG;
0017
0018 private:
0019 std::unique_ptr<AlgoT> m_algo;
0020
0021 PodioInput<edm4eic::ProtoCluster> m_proto_input{this};
0022 PodioInput<edm4eic::MCRecoCalorimeterHitAssociation> m_mchitassocs_input{this};
0023
0024 PodioOutput<edm4eic::Cluster> m_cluster_output{this};
0025 PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assoc_output{this};
0026
0027 ParameterRef<std::string> m_energyWeight{this, "energyWeight", config().energyWeight};
0028 ParameterRef<double> m_samplingFraction{this, "samplingFraction", config().sampFrac};
0029 ParameterRef<double> m_logWeightBase{this, "logWeightBase", config().logWeightBase};
0030 ParameterRef<std::vector<double>> m_logWeightBaseCoeffs{this, "logWeightBaseCoeffs",
0031 config().logWeightBaseCoeffs};
0032 ParameterRef<double> m_logWeightBase_Eref{this, "logWeightBase_Eref",
0033 config().logWeightBase_Eref};
0034 ParameterRef<bool> m_enableEtaBounds{this, "enableEtaBounds", config().enableEtaBounds};
0035
0036 Service<AlgorithmsInit_service> m_algorithmsInit{this};
0037
0038 public:
0039 void Configure() {
0040 m_algo = std::make_unique<AlgoT>(GetPrefix());
0041 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0042 m_algo->applyConfig(config());
0043 m_algo->init();
0044 }
0045
0046 void ChangeRun(int32_t ) {}
0047
0048 void Process(int32_t , uint64_t ) {
0049 m_algo->process({m_proto_input(), m_mchitassocs_input()},
0050 {m_cluster_output().get(), m_assoc_output().get()});
0051 }
0052 };
0053
0054 }