Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (C) 2022, 2023 Christopher Dilks
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <Acts/Surfaces/Surface.hpp>
0007 #include <JANA/JEvent.h>
0008 #include <edm4eic/TrackPoint.h>
0009 #include <edm4eic/TrackSegmentCollection.h>
0010 #include <functional>
0011 #include <map>
0012 #include <memory>
0013 #include <string>
0014 #include <utility>
0015 #include <vector>
0016 
0017 // algorithms
0018 #include "algorithms/tracking/TrackPropagation.h"
0019 #include "algorithms/tracking/TrackPropagationConfig.h"
0020 #include "extensions/jana/JOmniFactory.h"
0021 #include "services/geometry/acts/ACTSGeo_service.h"
0022 #include "services/geometry/dd4hep/DD4hep_service.h"
0023 
0024 namespace eicrecon {
0025 
0026 class RichTrack_factory : public JOmniFactory<RichTrack_factory, TrackPropagationConfig> {
0027 
0028 private:
0029   using AlgoT = eicrecon::TrackPropagation;
0030   std::unique_ptr<AlgoT> m_algo;
0031 
0032   PodioInput<edm4eic::Track> m_tracks_input{this};
0033   Input<ActsExamples::Trajectories> m_acts_trajectories_input{this};
0034   Input<ActsExamples::ConstTrackContainer> m_acts_tracks_input{this};
0035   PodioOutput<edm4eic::TrackSegment> m_track_segments_output{this};
0036 
0037   Service<DD4hep_service> m_GeoSvc{this};
0038   Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0039 
0040 public:
0041   void Configure() {
0042     m_algo = std::make_unique<AlgoT>();
0043     m_algo->applyConfig(config());
0044 
0045     if (config().filter_surfaces.empty())
0046       throw JException("cannot find filter surface for RICH track propagation");
0047 
0048     m_algo->init(m_GeoSvc().detector(), m_ACTSGeoSvc().actsGeoProvider(), logger());
0049   }
0050 
0051   void ChangeRun(int32_t /* run_number */) {}
0052 
0053   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0054     m_algo->propagateToSurfaceList(
0055         {*m_tracks_input(), m_acts_trajectories_input(), m_acts_tracks_input()},
0056         {m_track_segments_output().get()});
0057   }
0058 };
0059 
0060 } // namespace eicrecon