Back to home page

EIC code displayed by LXR

 
 

    


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

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 :
0027         public JOmniFactory<RichTrack_factory, TrackPropagationConfig> {
0028 
0029 private:
0030     using AlgoT = eicrecon::TrackPropagation;
0031     std::unique_ptr<AlgoT> m_algo;
0032 
0033     PodioInput<edm4eic::Track> m_tracks_input {this};
0034     Input<ActsExamples::Trajectories> m_acts_trajectories_input {this};
0035     Input<ActsExamples::ConstTrackContainer> m_acts_tracks_input {this};
0036     PodioOutput<edm4eic::TrackSegment> m_track_segments_output {this};
0037 
0038     Service<DD4hep_service> m_GeoSvc {this};
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 
0046         if (config().filter_surfaces.empty())
0047           throw JException("cannot find filter surface for RICH track propagation");
0048 
0049         m_algo->init(m_GeoSvc().detector(), m_ACTSGeoSvc().actsGeoProvider(), logger());
0050     }
0051 
0052     void ChangeRun(int64_t run_number) {
0053     }
0054 
0055     void Process(int64_t run_number, uint64_t event_number) {
0056         m_algo->propagateToSurfaceList(
0057             {*m_tracks_input(), m_acts_trajectories_input(), m_acts_tracks_input()},
0058             {m_track_segments_output().get()}
0059         );
0060     }
0061 };
0062 
0063 } // eicrecon