Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:02:58

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <Eigen/Core>
0007 #include <algorithms/algorithm.h>
0008 #include <algorithms/interfaces/WithPodConfig.h>
0009 #include <edm4eic/TrackSegmentCollection.h>
0010 #include <edm4hep/TrackerHitCollection.h>
0011 #include <gsl/pointers>
0012 #include <string>
0013 #include <string_view>
0014 #include <vector>
0015 
0016 #include "FarDetectorLinearTrackingConfig.h"
0017 
0018 namespace eicrecon {
0019 
0020 using FarDetectorLinearTrackingAlgorithm =
0021     algorithms::Algorithm<algorithms::Input<std::vector<edm4hep::TrackerHitCollection>>,
0022                           algorithms::Output<edm4eic::TrackSegmentCollection>>;
0023 
0024 class FarDetectorLinearTracking : public FarDetectorLinearTrackingAlgorithm,
0025                                   public WithPodConfig<FarDetectorLinearTrackingConfig> {
0026 
0027 public:
0028   FarDetectorLinearTracking(std::string_view name)
0029       : FarDetectorLinearTrackingAlgorithm{name,
0030                                            {"inputHitCollections"},
0031                                            {"outputTrackSegments"},
0032                                            "Fit track segments from hits in the tracker layers"} {}
0033 
0034   /** One time initialization **/
0035   void init() final;
0036 
0037   /** Event by event processing **/
0038   void process(const Input&, const Output&) const final;
0039 
0040 private:
0041   Eigen::VectorXd m_layerWeights;
0042 
0043   Eigen::Vector3d m_optimumDirection;
0044 
0045   void
0046   buildMatrixRecursive(int level, Eigen::MatrixXd* hitMatrix,
0047                        const std::vector<gsl::not_null<const edm4hep::TrackerHitCollection*>>& hits,
0048                        gsl::not_null<edm4eic::TrackSegmentCollection*> outputTracks) const;
0049 
0050   void checkHitCombination(Eigen::MatrixXd* hitMatrix,
0051                            gsl::not_null<edm4eic::TrackSegmentCollection*> outputTracks) const;
0052 
0053   bool checkHitPair(const Eigen::Vector3d& hit1, const Eigen::Vector3d& hit2) const;
0054 };
0055 
0056 } // namespace eicrecon