Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:33:27

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 private:
0018     std::unique_ptr<AlgoT> m_algo;
0019 
0020     PodioInput<edm4eic::ProtoCluster> m_protos_input {this};
0021 #if EDM4EIC_VERSION_MAJOR >= 7
0022     PodioInput<edm4eic::MCRecoCalorimeterHitAssociation> m_mchitassocs_input {this};
0023 #else
0024     PodioInput<edm4hep::SimCalorimeterHit> m_mchits_input {this};
0025 #endif
0026 
0027     PodioOutput<edm4eic::Cluster> m_clusters_output {this};
0028     PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assocs_output {this};
0029     PodioOutput<edm4eic::Cluster> m_layers_output {this};
0030 
0031     ParameterRef<int> m_trackStopLayer {this, "trackStopLayer", config().trackStopLayer};
0032 
0033     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0034 
0035 public:
0036     void Configure() {
0037         m_algo = std::make_unique<AlgoT>(GetPrefix());
0038         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0039         m_algo->applyConfig(config());
0040         m_algo->init();
0041     }
0042 
0043     void ChangeRun(int64_t run_number) {
0044     }
0045 
0046     void Process(int64_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 } // eicrecon