Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-06 08:35:12

0001 // Copyright (C) 2022 - 2024 Christopher Dilks, Wouter Deconinck
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <JANA/JEvent.h>
0007 #include <edm4eic/TrackSegmentCollection.h>
0008 #include <memory>
0009 #include <string>
0010 #include <utility>
0011 #include <vector>
0012 
0013 // algorithms
0014 #include "algorithms/interfaces/WithPodConfig.h"
0015 #include "algorithms/pid/MergeTracks.h"
0016 #include "extensions/jana/JOmniFactory.h"
0017 
0018 namespace eicrecon {
0019 
0020 class MergeTrack_factory : public JOmniFactory<MergeTrack_factory> {
0021 private:
0022   // Underlying algorithm
0023   std::unique_ptr<eicrecon::MergeTracks> m_algo;
0024 
0025   // Declare inputs
0026   VariadicPodioInput<edm4eic::TrackSegment> m_track_segments_input{this};
0027 
0028   // Declare outputs
0029   PodioOutput<edm4eic::TrackSegment> m_track_segments_output{this};
0030 
0031 public:
0032   void Configure() {
0033     m_algo = std::make_unique<MergeTracks>(GetPrefix());
0034     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0035     m_algo->init();
0036   }
0037 
0038   void ChangeRun(int32_t /* run_number */) {}
0039 
0040   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0041     auto in1 = m_track_segments_input();
0042     std::vector<gsl::not_null<const edm4eic::TrackSegmentCollection*>> in2;
0043     std::copy(in1.cbegin(), in1.cend(), std::back_inserter(in2));
0044 
0045     m_algo->process({in2}, {m_track_segments_output().get()});
0046   }
0047 };
0048 } // namespace eicrecon