Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-08 07:53:31

0001 // Created by Joe Osborn
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 #pragma once
0006 
0007 #include <ActsExamples/EventData/Trajectories.hpp>
0008 #include <JANA/JEvent.h>
0009 #include <edm4eic/VertexCollection.h>
0010 #include <edm4eic/ReconstructedParticle.h>
0011 #include <memory>
0012 #include <string>
0013 #include <utility>
0014 #include <vector>
0015 
0016 #include "algorithms/tracking/IterativeVertexFinderConfig.h"
0017 #include "algorithms/tracking/IterativeVertexFinder.h"
0018 #include "extensions/jana/JOmniFactory.h"
0019 
0020 namespace eicrecon {
0021 
0022 class IterativeVertexFinder_factory
0023     : public JOmniFactory<IterativeVertexFinder_factory, IterativeVertexFinderConfig> {
0024 
0025 private:
0026   using AlgoT = eicrecon::IterativeVertexFinder;
0027   std::unique_ptr<AlgoT> m_algo;
0028 
0029   Input<ActsExamples::Trajectories> m_acts_trajectories_input{this};
0030   PodioInput<edm4eic::ReconstructedParticle> m_edm4eic_reconParticles_input{this};
0031   PodioOutput<edm4eic::Vertex> m_vertices_output{this};
0032 
0033   ParameterRef<int> m_maxVertices{this, "maxVertices", config().maxVertices,
0034                                   "Maximum num vertices that can be found"};
0035   ParameterRef<bool> m_reassignTracksAfterFirstFit{
0036       this, "reassignTracksAfterFirstFit", config().reassignTracksAfterFirstFit,
0037       "Whether or not to reassign tracks after first fit"};
0038 
0039   Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0040 
0041 public:
0042   void Configure() {
0043     m_algo = std::make_unique<AlgoT>();
0044     m_algo->applyConfig(config());
0045     m_algo->init(m_ACTSGeoSvc().actsGeoProvider(), logger());
0046   }
0047 
0048   void ChangeRun(int32_t /* run_number */) {}
0049 
0050   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0051     m_vertices_output() =
0052         m_algo->produce(m_acts_trajectories_input(), m_edm4eic_reconParticles_input());
0053   }
0054 };
0055 
0056 } // namespace eicrecon