Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Xin Dong
0003 
0004 #pragma once
0005 
0006 #include <JANA/JEvent.h>
0007 #include <memory>
0008 #include <string>
0009 #include <utility>
0010 #include <vector>
0011 
0012 #include "algorithms/reco/PrimaryVertices.h"
0013 #include "algorithms/reco/PrimaryVerticesConfig.h"
0014 #include "services/algorithms_init/AlgorithmsInit_service.h"
0015 #include "extensions/jana/JOmniFactory.h"
0016 
0017 namespace eicrecon {
0018 
0019 class PrimaryVertices_factory :
0020         public JOmniFactory<PrimaryVertices_factory, PrimaryVerticesConfig> {
0021 
0022 public:
0023     using AlgoT = eicrecon::PrimaryVertices;
0024 private:
0025     std::unique_ptr<AlgoT> m_algo;
0026 
0027     PodioInput<edm4eic::Vertex> m_rc_vertices_input {this};
0028 
0029     // Declare outputs
0030     PodioOutput<edm4eic::Vertex> m_primary_vertices_output {this};
0031 
0032     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0033 
0034 public:
0035     void Configure() {
0036         m_algo = std::make_unique<AlgoT>(GetPrefix());
0037         m_algo->level((algorithms::LogLevel)logger()->level());
0038 
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         m_algo->process({m_rc_vertices_input()}, {m_primary_vertices_output().get()});
0048     }
0049 };
0050 
0051 } // eicrecon