Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-02 07:54:37

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include "algorithms/calorimetry/ImagingClusterReco.h"
0007 #include "extensions/jana/JOmniFactory.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 
0010 namespace eicrecon {
0011 
0012 class ImagingClusterReco_factory
0013     : public JOmniFactory<ImagingClusterReco_factory, ImagingClusterRecoConfig> {
0014 
0015 public:
0016   using AlgoT = eicrecon::ImagingClusterReco;
0017 
0018 private:
0019   std::unique_ptr<AlgoT> m_algo;
0020 
0021   PodioInput<edm4eic::ProtoCluster> m_protos_input{this};
0022 #if EDM4EIC_VERSION_MAJOR >= 7
0023   PodioInput<edm4eic::MCRecoCalorimeterHitAssociation> m_mchitassocs_input{this};
0024 #else
0025   PodioInput<edm4hep::SimCalorimeterHit> m_mchits_input{this};
0026 #endif
0027 
0028   PodioOutput<edm4eic::Cluster> m_clusters_output{this};
0029   PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assocs_output{this};
0030   PodioOutput<edm4eic::Cluster> m_layers_output{this};
0031 
0032   ParameterRef<int> m_trackStopLayer{this, "trackStopLayer", config().trackStopLayer};
0033 
0034   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0035 
0036 public:
0037   void Configure() {
0038     m_algo = std::make_unique<AlgoT>(GetPrefix());
0039     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0040     m_algo->applyConfig(config());
0041     m_algo->init();
0042   }
0043 
0044   void ChangeRun(int32_t /* run_number */) {}
0045 
0046   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0047 #if EDM4EIC_VERSION_MAJOR >= 7
0048     m_algo->process({m_protos_input(), m_mchitassocs_input()},
0049 #else
0050     m_algo->process({m_protos_input(), m_mchits_input()},
0051 #endif
0052                     {m_clusters_output().get(), m_assocs_output().get(), m_layers_output().get()});
0053   }
0054 };
0055 
0056 } // namespace eicrecon