Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-06 08:35:12

0001 // Created by Dmitry Romanov
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 #pragma once
0006 
0007 #include <algorithms/logger.h>
0008 #include <edm4eic/ClusterCollection.h>
0009 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0010 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0011 #include <edm4eic/ReconstructedParticleCollection.h>
0012 #include <edm4hep/MCParticleCollection.h>
0013 #include <spdlog/logger.h>
0014 #include <stdint.h>
0015 #include <memory>
0016 
0017 #include "algorithms/reco/MatchClusters.h"
0018 #include "extensions/jana/JOmniFactory.h"
0019 #include "services/algorithms_init/AlgorithmsInit_service.h"
0020 
0021 namespace eicrecon {
0022 
0023 class MatchClusters_factory : public JOmniFactory<MatchClusters_factory> {
0024 private:
0025   // Underlying algorithm
0026   std::unique_ptr<eicrecon::MatchClusters> m_algo;
0027 
0028   // Declare inputs
0029   PodioInput<edm4hep::MCParticle> m_mc_parts_input{this};
0030   PodioInput<edm4eic::ReconstructedParticle> m_rec_parts_input{this};
0031   PodioInput<edm4eic::MCRecoParticleAssociation> m_rec_assocs_input{this};
0032   PodioInput<edm4eic::Cluster> m_clusters_input{this};
0033   PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assocs_input{this};
0034 
0035   // Declare outputs
0036   PodioOutput<edm4eic::ReconstructedParticle> m_rec_parts_output{this};
0037   PodioOutput<edm4eic::MCRecoParticleAssociation> m_rec_assocs_output{this};
0038 
0039   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0040 
0041 public:
0042   void Configure() {
0043     m_algo = std::make_unique<MatchClusters>(GetPrefix());
0044     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0045     m_algo->init();
0046   }
0047 
0048   void ChangeRun(int32_t /* run_number */) {}
0049 
0050   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0051     m_algo->process(
0052         {
0053             m_mc_parts_input(),
0054             m_rec_parts_input(),
0055             m_rec_assocs_input(),
0056             m_clusters_input(),
0057             m_cluster_assocs_input(),
0058         },
0059         {
0060             m_rec_parts_output().get(),
0061             m_rec_assocs_output().get(),
0062         });
0063   }
0064 };
0065 
0066 } // namespace eicrecon