Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-20 08:24:26

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 - 2025, Chao Peng, Sylvester Joosten, Whitney Armstrong, Wouter Deconinck, Nathan Brei, Sebouh Paul, Dmitry Kalinkin, Derek Anderson
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include "algorithms/calorimetry/CalorimeterClusterRecoCoG.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 #include "extensions/jana/JOmniFactory.h"
0010 
0011 namespace eicrecon {
0012 
0013 class CalorimeterClusterRecoCoG_factory
0014     : public JOmniFactory<CalorimeterClusterRecoCoG_factory, CalorimeterClusterRecoCoGConfig> {
0015 
0016 public:
0017   using AlgoT = eicrecon::CalorimeterClusterRecoCoG;
0018 
0019 private:
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   PodioInput<edm4eic::ProtoCluster> m_proto_input{this};
0023   PodioInput<edm4eic::MCRecoCalorimeterHitLink, true> m_mchitlinks_input{
0024       this}; // Optional: for truth associations
0025   PodioInput<edm4eic::MCRecoCalorimeterHitAssociation, true> m_mchitassocs_input{
0026       this}; // Optional: for truth associations
0027 
0028   PodioOutput<edm4eic::Cluster> m_cluster_output{this};
0029   PodioOutput<edm4eic::MCRecoClusterParticleLink> m_links_output{this};
0030   PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assoc_output{this};
0031 
0032   ParameterRef<std::string> m_energyWeight{this, "energyWeight", config().energyWeight};
0033   ParameterRef<double> m_samplingFraction{this, "samplingFraction", config().sampFrac};
0034   ParameterRef<double> m_logWeightBase{this, "logWeightBase", config().logWeightBase};
0035   ParameterRef<std::vector<double>> m_logWeightBaseCoeffs{this, "logWeightBaseCoeffs",
0036                                                           config().logWeightBaseCoeffs};
0037   ParameterRef<double> m_logWeightBase_Eref{this, "logWeightBase_Eref",
0038                                             config().logWeightBase_Eref};
0039   ParameterRef<bool> m_enableEtaBounds{this, "enableEtaBounds", config().enableEtaBounds};
0040 
0041   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0042 
0043 public:
0044   void Configure() {
0045     m_algo = std::make_unique<AlgoT>(GetPrefix());
0046     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0047     m_algo->applyConfig(config());
0048     m_algo->init();
0049   }
0050 
0051   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0052     m_algo->process({m_proto_input(), m_mchitlinks_input(), m_mchitassocs_input()},
0053                     {m_cluster_output().get(), m_links_output().get(), m_assoc_output().get()});
0054   }
0055 };
0056 
0057 } // namespace eicrecon