Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:06

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 
0026     // Underlying algorithm
0027     std::unique_ptr<eicrecon::MatchClusters> m_algo;
0028 
0029     // Declare inputs
0030     PodioInput<edm4hep::MCParticle> m_mc_parts_input {this};
0031     PodioInput<edm4eic::ReconstructedParticle> m_rec_parts_input {this};
0032     PodioInput<edm4eic::MCRecoParticleAssociation> m_rec_assocs_input {this};
0033     PodioInput<edm4eic::Cluster> m_clusters_input {this};
0034     PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assocs_input {this};
0035 
0036     // Declare outputs
0037     PodioOutput<edm4eic::ReconstructedParticle> m_rec_parts_output {this};
0038     PodioOutput<edm4eic::MCRecoParticleAssociation> m_rec_assocs_output {this};
0039 
0040     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0041 
0042 public:
0043     void Configure() {
0044         m_algo = std::make_unique<MatchClusters>(GetPrefix());
0045         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0046         m_algo->init();
0047     }
0048 
0049     void ChangeRun(int64_t run_number) { }
0050 
0051     void Process(int64_t run_number, uint64_t event_number) {
0052         m_algo->process(
0053             {
0054                 m_mc_parts_input(),
0055                 m_rec_parts_input(),
0056                 m_rec_assocs_input(),
0057                 m_clusters_input(),
0058                 m_cluster_assocs_input(),
0059             },
0060             {
0061                 m_rec_parts_output().get(),
0062                 m_rec_assocs_output().get(),
0063             }
0064         );
0065     }
0066 
0067   };
0068 
0069 } // eicrecon