Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0023     // Underlying algorithm
0024     std::unique_ptr<eicrecon::MergeTracks> m_algo;
0025 
0026     // Declare inputs
0027     VariadicPodioInput<edm4eic::TrackSegment> m_track_segments_input {this};
0028 
0029     // Declare outputs
0030     PodioOutput<edm4eic::TrackSegment> m_track_segments_output {this};
0031 
0032 public:
0033     void Configure() {
0034         m_algo = std::make_unique<MergeTracks>(GetPrefix());
0035         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0036         m_algo->init();
0037     }
0038 
0039     void ChangeRun(int64_t run_number) { }
0040 
0041     void Process(int64_t run_number, uint64_t event_number) {
0042         auto in1 = m_track_segments_input();
0043         std::vector<gsl::not_null<const edm4eic::TrackSegmentCollection*>> in2;
0044         std::copy(in1.cbegin(), in1.cend(), std::back_inserter(in2));
0045 
0046         m_algo->process({in2}, {m_track_segments_output().get()});
0047     }
0048 
0049   };
0050 }