Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 07:56:32

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 
0025 private:
0026   std::unique_ptr<AlgoT> m_algo;
0027 
0028   PodioInput<edm4eic::Vertex> m_rc_vertices_input{this};
0029 
0030   // Declare outputs
0031   PodioOutput<edm4eic::Vertex> m_primary_vertices_output{this};
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((algorithms::LogLevel)logger()->level());
0039 
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     m_algo->process({m_rc_vertices_input()}, {m_primary_vertices_output().get()});
0048   }
0049 };
0050 
0051 } // namespace eicrecon