Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-07 08:04:12

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2025 Dongwi H. Dongwi (Bishoy)
0003 
0004 #pragma once
0005 
0006 #include <Acts/EventData/VectorMultiTrajectory.hpp>
0007 #include <Acts/EventData/VectorTrackContainer.hpp>
0008 #include <Acts/MagneticField/MagneticFieldProvider.hpp>
0009 #include <Acts/Propagator/EigenStepper.hpp>
0010 #include <Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp>
0011 #include <Acts/Vertexing/AdaptiveMultiVertexFinder.hpp>
0012 #include <Acts/Vertexing/AdaptiveMultiVertexFitter.hpp>
0013 #include <Acts/Vertexing/HelicalTrackLinearizer.hpp>
0014 #include <Acts/Vertexing/ImpactPointEstimator.hpp>
0015 #include <Acts/Vertexing/Vertex.hpp>
0016 #include <Acts/Vertexing/VertexingOptions.hpp>
0017 #include <algorithms/algorithm.h>
0018 #include <edm4eic/ReconstructedParticleCollection.h>
0019 #include <edm4eic/VertexCollection.h>
0020 #include <memory>
0021 #include <string>
0022 #include <string_view>
0023 #include <vector>
0024 
0025 #include "algorithms/interfaces/ActsSvc.h"
0026 #include "algorithms/interfaces/WithPodConfig.h"
0027 #include "algorithms/tracking/ActsGeometryProvider.h"
0028 #include "algorithms/tracking/SecondaryVertexFinderConfig.h"
0029 
0030 namespace eicrecon {
0031 
0032 using SecondaryVertexFinderAlgorithm = algorithms::Algorithm<
0033     algorithms::Input<edm4eic::ReconstructedParticleCollection, Acts::ConstVectorMultiTrajectory,
0034                       Acts::ConstVectorTrackContainer>,
0035     algorithms::Output<edm4eic::VertexCollection, edm4eic::VertexCollection>>;
0036 
0037 class SecondaryVertexFinder : public SecondaryVertexFinderAlgorithm,
0038                               public WithPodConfig<eicrecon::SecondaryVertexFinderConfig> {
0039 public:
0040   SecondaryVertexFinder(std::string_view name)
0041       : SecondaryVertexFinderAlgorithm{
0042             name,
0043             {"inputReconstructedParticles", "inputActsTrackStates", "inputActsTracks"},
0044             {"outputPrimaryVertices", "outputSecondaryVertices"},
0045             "Finds vertices using ACTS Adaptive Multi-Vertex Finder (AMVF)"} {}
0046 
0047   void init() final {};
0048 
0049   void process(const Input&, const Output&) const final;
0050 
0051 private:
0052   // Calculate an initial Primary Vertex
0053   void calculatePrimaryVertex(const edm4eic::ReconstructedParticleCollection&,
0054                               const Acts::ConstVectorMultiTrajectory* trackStates,
0055                               const Acts::ConstVectorTrackContainer* tracks, Acts::EigenStepper<>,
0056                               edm4eic::VertexCollection&) const;
0057 
0058   //Calculate secondary vertex and store secVertex container
0059   void calculateSecondaryVertex(const edm4eic::ReconstructedParticleCollection&,
0060                                 const Acts::ConstVectorMultiTrajectory* trackStates,
0061                                 const Acts::ConstVectorTrackContainer* tracks, Acts::EigenStepper<>,
0062                                 edm4eic::VertexCollection&) const;
0063 
0064   // Functions to be used to check efficacy of sec. vertex
0065   void setVertexContainer(std::vector<Acts::Vertex> inputcontainer) {
0066     vtx_container = inputcontainer;
0067   };
0068 
0069   //set up Impact estimator
0070   using ImpactPointEstimator   = Acts::ImpactPointEstimator;
0071   using LinearizerSec          = Acts::HelicalTrackLinearizer;
0072   using VertexFitterSec        = Acts::AdaptiveMultiVertexFitter;
0073   using VertexFinderSec        = Acts::AdaptiveMultiVertexFinder;
0074   using VertexFinderOptionsSec = Acts::VertexingOptions;
0075   using seedFinder             = Acts::AdaptiveGridDensityVertexFinder;
0076 
0077   std::shared_ptr<const ActsGeometryProvider> m_geoSvc{
0078       algorithms::ActsSvc::instance().acts_geometry_provider()};
0079   std::shared_ptr<const Acts::MagneticFieldProvider> m_BField{m_geoSvc->getFieldProvider()};
0080   std::vector<Acts::Vertex> vtx_container;
0081 };
0082 
0083 } // namespace eicrecon