Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright 2022 - 2025 Dmitry Romanov, Dmitry Kalinkin
0003 
0004 #pragma once
0005 
0006 #include <ActsExamples/EventData/Trajectories.hpp>
0007 #include <JANA/JEvent.h>
0008 #include <edm4eic/TrackSegmentCollection.h>
0009 #include <memory>
0010 #include <string>
0011 #include <utility>
0012 #include <vector>
0013 
0014 #include "algorithms/tracking/TrackProjector.h"
0015 #include "extensions/jana/JOmniFactory.h"
0016 
0017 namespace eicrecon {
0018 
0019 class TrackProjector_factory : public JOmniFactory<TrackProjector_factory> {
0020 
0021 private:
0022   using AlgoT = eicrecon::TrackProjector;
0023 
0024   std::unique_ptr<AlgoT> m_algo;
0025 
0026   Input<ActsExamples::Trajectories> m_acts_trajectories_input{this};
0027   PodioInput<edm4eic::Track> m_tracks_input{this};
0028   PodioOutput<edm4eic::TrackSegment> m_segments_output{this};
0029 
0030   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0031 
0032 public:
0033   void Configure() {
0034     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0035     m_algo->level((algorithms::LogLevel)logger()->level());
0036     m_algo->init();
0037   }
0038 
0039   void ChangeRun(int32_t /* run_number */) {}
0040 
0041   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0042     std::vector<gsl::not_null<const ActsExamples::Trajectories*>> acts_trajectories_input;
0043     for (auto acts_traj : m_acts_trajectories_input()) {
0044       acts_trajectories_input.push_back(acts_traj);
0045     }
0046     m_algo->process(
0047         {
0048             acts_trajectories_input,
0049             m_tracks_input(),
0050         },
0051         {
0052             m_segments_output().get(),
0053         });
0054   }
0055 };
0056 
0057 } // namespace eicrecon