diff --git a/JugBase/src/components/InputCopier.cpp b/JugBase/src/components/InputCopier.cpp deleted file mode 100644 index b722d18d..00000000 --- a/JugBase/src/components/InputCopier.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -// Deprecated algorithm, as we can now properly store input collections in our output - -#include -#include "GaudiAlg/Transformer.h" -#include "GaudiAlg/Producer.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/GaudiAlgorithm.h" - -// FCCSW -#include "JugBase/DataHandle.h" - -// Event Model related classes -#include "edm4hep/MCParticleCollection.h" -#include "edm4hep/SimCalorimeterHitCollection.h" -#include "edm4hep/SimTrackerHitCollection.h" - - -namespace Jug::Base { - - /** Need to fix a bug. - * - * Details found here: - * https://github.com/AIDASoft/podio/issues/103 - */ - template - class InputCopier : public GaudiAlgorithm { - public: - InputCopier(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) - { - declareProperty("inputCollection", m_inputHitCollection, "MCParticles"); - declareProperty("outputCollection", m_outputHitCollection, "genparticles"); - } - StatusCode initialize() override - { - if (GaudiAlgorithm::initialize().isFailure()) { - return StatusCode::FAILURE; - } - warning() << "DEPRECATED ALGORITHM, no need to use this anymore, we can do a proper straight passthrough from input to output." << endmsg; - warning() << "1) Remove the calls to InputCopier from your options file." << endmsg; - warning() << "2) Add 'keep mcparticles' to the PodioOutput.outputCommands." << endmsg; - warning() << "3) Update your analysis code to use 'mcparticles' directly." << endmsg; - return StatusCode::SUCCESS; - } - StatusCode execute() override - { - // input collection - const T_IN* simhits = m_inputHitCollection.get(); - // output collection - auto* out_parts = m_outputHitCollection.createAndPut(); - for (const auto& ahit : *simhits) { - out_parts->push_back(ahit.clone()); - } - return StatusCode::SUCCESS; - } - - DataHandle m_inputHitCollection{"MCParticles", Gaudi::DataHandle::Reader, this}; - DataHandle m_outputHitCollection{"genparticles", Gaudi::DataHandle::Writer, this}; - }; - - using CalorimeterColCopier = InputCopier; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(CalorimeterColCopier) - - using TrackerColCopier = InputCopier; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackerColCopier) - - using MCCopier = InputCopier; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(MCCopier) - -} // namespace Jug::Base diff --git a/JugBase/src/components/ReadTestConsumer.cxx b/JugBase/src/components/ReadTestConsumer.cxx deleted file mode 100644 index 019a0529..00000000 --- a/JugBase/src/components/ReadTestConsumer.cxx +++ /dev/null @@ -1,45 +0,0 @@ -#include "GaudiAlg/GaudiAlgorithm.h" - -#include "JugBase/DataHandle.h" - -#include "edm4hep/MCParticleCollection.h" - -class ReadTestConsumer : public GaudiAlgorithm { - -public: - ReadTestConsumer(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc), m_genParticles("MCParticles", Gaudi::DataHandle::Reader, this) { - declareProperty("genParticles", m_genParticles, "mc particles to read"); - } - - ~ReadTestConsumer() = default; - - StatusCode initialize() { - warning() << "This is a deprecated test algorithm" << endmsg; - return GaudiAlgorithm::initialize(); } - - StatusCode execute() { - // Read the input - const edm4hep::MCParticleCollection* mcparticles = m_genParticles.get(); - - // Does the reading work? - debug() << mcparticles << endmsg; - debug() << "MCParticle size: " << mcparticles->size() << endmsg; - // counter for debug messages below - //int cntr = 0; - // Loop over all input particles - //for (const auto& mcpart : *mcparticles) { - // if (10 > cntr++) { - // debug() << "time: " << mcpart.time << endmsg; - // } - //} - return StatusCode::SUCCESS; - } - - StatusCode finalize() { return GaudiAlgorithm::finalize(); } - -private: - /// Particles to read - DataHandle m_genParticles; -}; -DECLARE_COMPONENT(ReadTestConsumer) diff --git a/JugReco/src/components/TrackingHitsCollector.cpp b/JugReco/src/components/TrackingHitsCollector.cpp deleted file mode 100644 index 0e4d1ea7..00000000 --- a/JugReco/src/components/TrackingHitsCollector.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Sylvester Joosten, Chao Peng - -// Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/Transformer.h" - -#include "JugBase/DataHandle.h" - -// Event Model related classes -#include "edm4eic/TrackerHitCollection.h" - -namespace Jug::Reco { - - /** Collect the tracking hits into a single collection. - * - * \ingroup reco - */ - class TrackingHitsCollector : public GaudiAlgorithm { - private: - DataHandle m_trackerBarrelHits{"trackerBarrelHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_trackerEndcapHits{"trackerEndcapHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexBarrelHits {"vertexBarrelHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexEndcapHits {"vertexEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_gemEndcapHits {"gemEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; - - public: - TrackingHitsCollector(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { - declareProperty("trackerBarrelHits", m_trackerBarrelHits, ""); - declareProperty("trackerEndcapHits", m_trackerEndcapHits, ""); - declareProperty("vertexBarrelHits" , m_vertexBarrelHits , ""); - declareProperty("vertexEndcapHits" , m_vertexEndcapHits , ""); - declareProperty("gemEndcapHits" , m_gemEndcapHits , ""); - declareProperty("outputHitCollection", m_outputHitCollection, ""); - } - - StatusCode initialize() override - { - warning() << "DEPRECATED, use TrackingHitsCollector2 instead" << endmsg; - return StatusCode::SUCCESS; - } - - StatusCode execute() override - { - const edm4eic::TrackerHitCollection* trkBarrelHits = m_trackerBarrelHits.get(); - const edm4eic::TrackerHitCollection* trkEndcapHits = m_trackerEndcapHits.get(); - const edm4eic::TrackerHitCollection* vtxBarrelHits = m_vertexBarrelHits .get(); - const edm4eic::TrackerHitCollection* vtxEndcapHits = m_vertexEndcapHits .get(); - const edm4eic::TrackerHitCollection* gemEndcapHits = m_gemEndcapHits .get(); - auto* outputHits = m_outputHitCollection.createAndPut(); - - for (const auto* hits : {trkBarrelHits, trkEndcapHits, vtxBarrelHits, vtxEndcapHits, gemEndcapHits}) { - if (hits != nullptr) { - for (const auto& ahit : *hits) { - auto new_hit = ahit.clone(); - outputHits->push_back(ahit.clone()); - } - } - } - - return StatusCode::SUCCESS; - } - }; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackingHitsCollector) - -} // namespace Jug::Reco diff --git a/JugReco/src/components/TrackingHitsCollector2.cpp b/JugReco/src/components/TrackingHitsCollector2.cpp index 17afb4f2..f246e6ba 100644 --- a/JugReco/src/components/TrackingHitsCollector2.cpp +++ b/JugReco/src/components/TrackingHitsCollector2.cpp @@ -71,6 +71,8 @@ namespace Jug::Reco { } }; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) + DECLARE_COMPONENT_WITH_ID(TrackingHitsCollector2, "TrackingHitsCollector") + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(TrackingHitsCollector2) } // namespace Jug::Reco diff --git a/JugTrack/src/components/TrackFindingAlgorithm.cpp b/JugTrack/src/components/TrackFindingAlgorithm.cpp deleted file mode 100644 index edab5b27..00000000 --- a/JugTrack/src/components/TrackFindingAlgorithm.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -#include "TrackFindingAlgorithm.h" - -// Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiAlg/Transformer.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiKernel/RndmGenerators.h" -#include "Gaudi/Property.h" - -#include "DDRec/CellIDPositionConverter.h" -#include "DDRec/SurfaceManager.h" -#include "DDRec/Surface.h" - -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp" -#include "Acts/Surfaces/PerigeeSurface.hpp" - -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" -#include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" -#include "Acts/Definitions/Common.hpp" -#include "Acts/Utilities/Helpers.hpp" -#include "Acts/Utilities/Logger.hpp" -#include "Acts/Definitions/Units.hpp" - -#include "JugBase/DataHandle.h" -#include "JugBase/IGeoSvc.h" -#include "JugBase/BField/DD4hepBField.h" - -#include "JugTrack/GeometryContainers.hpp" -#include "JugTrack/Measurement.hpp" -#include "JugTrack/Index.hpp" -#include "JugTrack/IndexSourceLink.hpp" -#include "JugTrack/Track.hpp" - - -#include "edm4eic/TrackerHitCollection.h" - -#include -#include -#include -#include -#include - - -static const std::map s_msgMap = { - {MSG::DEBUG, Acts::Logging::DEBUG}, - {MSG::VERBOSE, Acts::Logging::VERBOSE}, - {MSG::INFO, Acts::Logging::INFO}, - {MSG::WARNING, Acts::Logging::WARNING}, - {MSG::FATAL, Acts::Logging::FATAL}, - {MSG::ERROR, Acts::Logging::ERROR}, -}; - -namespace Jug::Reco { - - using namespace Acts::UnitLiterals; - - TrackFindingAlgorithm::TrackFindingAlgorithm(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { - declareProperty("inputSourceLinks", m_inputSourceLinks, ""); - declareProperty("inputMeasurements", m_inputMeasurements, ""); - declareProperty("inputInitialTrackParameters", m_inputInitialTrackParameters, ""); - declareProperty("outputTrajectories", m_outputTrajectories, ""); - } - - StatusCode TrackFindingAlgorithm::initialize() - { - warning() << "Deprecated algorithm, use CKFTracking instead" << endmsg; - if (GaudiAlgorithm::initialize().isFailure()) { - return StatusCode::FAILURE; - } - m_geoSvc = service("GeoSvc"); - if (!m_geoSvc) { - error() << "Unable to locate Geometry Service. " - << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg; - return StatusCode::FAILURE; - } - - m_BField = std::dynamic_pointer_cast(m_geoSvc->getFieldProvider()); - m_fieldctx = Jug::BField::BFieldVariant(m_BField); - - // eta bins, chi2 and #sourclinks per surface cutoffs - m_sourcelinkSelectorCfg = { - {Acts::GeometryIdentifier(), - {m_etaBins, m_chi2CutOff, - {m_numMeasurementsCutOff.begin(), m_numMeasurementsCutOff.end()} - } - }, - }; - m_trackFinderFunc = TrackFindingAlgorithm::makeTrackFinderFunction(m_geoSvc->trackingGeometry(), m_BField); - auto im = s_msgMap.find(msgLevel()); - if (im != s_msgMap.end()) { - m_actsLoggingLevel = im->second; - } - return StatusCode::SUCCESS; - } - - StatusCode TrackFindingAlgorithm::execute() - { - // Read input data - const auto* const src_links = m_inputSourceLinks.get(); - const auto* const init_trk_params = m_inputInitialTrackParameters.get(); - const auto* const measurements = m_inputMeasurements.get(); - - //// Prepare the output data with MultiTrajectory - // TrajectoryContainer trajectories; - auto* trajectories = m_outputTrajectories.createAndPut(); - trajectories->reserve(init_trk_params->size()); - - //// Construct a perigee surface as the target surface - auto pSurface = Acts::Surface::makeShared(Acts::Vector3{0., 0., 0.}); - - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("TrackFindingAlgorithm Logger", m_actsLoggingLevel)); - - Acts::PropagatorPlainOptions pOptions; - pOptions.maxSteps = 10000; - - MeasurementCalibrator calibrator{*measurements}; - Acts::GainMatrixUpdater kfUpdater; - Acts::GainMatrixSmoother kfSmoother; - Acts::MeasurementSelector measSel{m_sourcelinkSelectorCfg}; - - Acts::CombinatorialKalmanFilterExtensions extensions; - extensions.calibrator.connect<&MeasurementCalibrator::calibrate>(&calibrator); - extensions.updater.connect< - &Acts::GainMatrixUpdater::operator()>( - &kfUpdater); - extensions.smoother.connect< - &Acts::GainMatrixSmoother::operator()>( - &kfSmoother); - extensions.measurementSelector - .connect<&Acts::MeasurementSelector::select>( - &measSel); - - IndexSourceLinkAccessor slAccessor; - slAccessor.container = src_links; - Acts::SourceLinkAccessorDelegate - slAccessorDelegate; - slAccessorDelegate.connect<&IndexSourceLinkAccessor::range>(&slAccessor); - - // Set the CombinatorialKalmanFilter options - TrackFindingAlgorithm::TrackFinderOptions options( - m_geoctx, m_fieldctx, m_calibctx, slAccessorDelegate, - extensions, Acts::LoggerWrapper{logger()}, pOptions, &(*pSurface)); - - auto results = (*m_trackFinderFunc)(*init_trk_params, options); - - for (std::size_t iseed = 0; iseed < init_trk_params->size(); ++iseed) { - - auto& result = results[iseed]; - - if (result.ok()) { - // Get the track finding output object - auto& trackFindingOutput = result.value(); - // Create a SimMultiTrajectory - trajectories->emplace_back(std::move(trackFindingOutput.fittedStates), - std::move(trackFindingOutput.lastMeasurementIndices), - std::move(trackFindingOutput.fittedParameters)); - } else { - if (msgLevel(MSG::DEBUG)) { - debug() << "Track finding failed for truth seed " << iseed << " with error " << result.error() << endmsg; - } - } - } - - return StatusCode::SUCCESS; - } - - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackFindingAlgorithm) - -} // namespace Jug::Reco diff --git a/JugTrack/src/components/TrackFindingAlgorithm.h b/JugTrack/src/components/TrackFindingAlgorithm.h deleted file mode 100644 index e59ab05d..00000000 --- a/JugTrack/src/components/TrackFindingAlgorithm.h +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -#ifndef JUGGLER_JUGRECO_TrackFindingAlgorithm_HH -#define JUGGLER_JUGRECO_TrackFindingAlgorithm_HH - -#include -#include -#include -#include - -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "JugBase/DataHandle.h" -#include "JugBase/IGeoSvc.h" -#include "JugBase/BField/DD4hepBField.h" -#include "JugTrack/GeometryContainers.hpp" -#include "JugTrack/Index.hpp" -#include "JugTrack/IndexSourceLink.hpp" -#include "JugTrack/Measurement.hpp" -#include "JugTrack/Track.hpp" -#include "JugTrack/Trajectories.hpp" - -#include "edm4eic/TrackerHitCollection.h" - -#include "Acts/Definitions/Common.hpp" -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" -#include "Acts/TrackFinding/MeasurementSelector.hpp" - -namespace Jug::Reco { - -/** Fitting algorithm implmentation . - * - * \ingroup tracking - */ -class TrackFindingAlgorithm : public GaudiAlgorithm { -public: - /// Track finder function that takes input measurements, initial trackstate - /// and track finder options and returns some track-finder-specific result. - using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions; - using TrackFinderResult = std::vector>>; - - /// Find function that takes the above parameters - /// @note This is separated into a virtual interface to keep compilation units - /// small - class TrackFinderFunction { - public: - virtual ~TrackFinderFunction() = default; - virtual TrackFinderResult operator()(const TrackParametersContainer&, - const TrackFinderOptions&) const = 0; - }; - - /// Create the track finder function implementation. - /// The magnetic field is intentionally given by-value since the variant - /// contains shared_ptr anyways. - static std::shared_ptr makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField); - -public: - DataHandle m_inputSourceLinks{"inputSourceLinks", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputMeasurements{"inputMeasurements", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputInitialTrackParameters{"inputInitialTrackParameters", - Gaudi::DataHandle::Reader, this}; - DataHandle m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this}; - - Gaudi::Property> m_etaBins{this, "etaBins", {}}; - Gaudi::Property> m_chi2CutOff{this, "chi2CutOff", {15.}}; - Gaudi::Property> m_numMeasurementsCutOff{this, "numMeasurementsCutOff", {10}}; - - std::shared_ptr m_trackFinderFunc; - SmartIF m_geoSvc; - - std::shared_ptr m_BField = nullptr; - Acts::GeometryContext m_geoctx; - Acts::CalibrationContext m_calibctx; - Acts::MagneticFieldContext m_fieldctx; - - Acts::MeasurementSelector::Config m_sourcelinkSelectorCfg; - Acts::Logging::Level m_actsLoggingLevel = Acts::Logging::INFO; - - TrackFindingAlgorithm(const std::string& name, ISvcLocator* svcLoc); - - StatusCode initialize() override; - - StatusCode execute() override; -}; - -} // namespace Jug::Reco - -#endif diff --git a/JugTrack/src/components/TrackFindingAlgorithmFunction.cpp b/JugTrack/src/components/TrackFindingAlgorithmFunction.cpp deleted file mode 100644 index 1fea7cb3..00000000 --- a/JugTrack/src/components/TrackFindingAlgorithmFunction.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck, Sylvester Joosten - -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" - -#include "TrackFindingAlgorithm.h" - -#include "JugBase/BField/DD4hepBField.h" - - -#include -#include - -namespace { - using Updater = Acts::GainMatrixUpdater; - using Smoother = Acts::GainMatrixSmoother; - - using Stepper = Acts::EigenStepper<>; - using Navigator = Acts::Navigator; - using Propagator = Acts::Propagator; - using CKF = Acts::CombinatorialKalmanFilter; - - /** Finder implmentation . - * - * \ingroup track - */ - struct TrackFinderFunctionImpl - : public Jug::Reco::TrackFindingAlgorithm::TrackFinderFunction { - CKF trackFinder; - - TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {} - - Jug::Reco::TrackFindingAlgorithm::TrackFinderResult - operator()(const Jug::TrackParametersContainer& initialParameters, - const Jug::Reco::TrackFindingAlgorithm::TrackFinderOptions& options) - const override - { - return trackFinder.findTracks(initialParameters, options); - }; - }; - -} // namespace - -namespace Jug::Reco { - - std::shared_ptr - TrackFindingAlgorithm::makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField) - { - Stepper stepper(std::move(magneticField)); - Navigator::Config cfg{trackingGeometry}; - cfg.resolvePassive = false; - cfg.resolveMaterial = true; - cfg.resolveSensitive = true; - Navigator navigator(cfg); - - Propagator propagator(std::move(stepper), std::move(navigator)); - CKF trackFinder(std::move(propagator)); - - // build the track finder functions. onws the track finder object. - return std::make_shared(std::move(trackFinder)); - } - -} // namespace Jug::Reco diff --git a/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithm.h b/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithm.h deleted file mode 100644 index b5eeca42..00000000 --- a/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithm.h +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -#ifndef JUGGLER_JUGRECO_TrackFindingAlgorithm_HH -#define JUGGLER_JUGRECO_TrackFindingAlgorithm_HH - -#include -#include -#include -#include - -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "JugBase/DataHandle.h" -#include "JugBase/IGeoSvc.h" -#include "JugBase/BField/DD4hepBField.h" -#include "JugTrack/GeometryContainers.hpp" -#include "JugTrack/Index.hpp" -#include "JugTrack/IndexSourceLink.hpp" -#include "JugTrack/Measurement.hpp" -#include "JugTrack/Track.hpp" -#include "JugTrack/Trajectories.hpp" - -#include "edm4eic/TrackerHitCollection.h" - -#include "Acts/Definitions/Common.hpp" -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" -#include "Acts/TrackFinding/MeasurementSelector.hpp" - -namespace Jug::Reco { - -/** Fitting algorithm implmentation . - * - * \ingroup tracking - */ -class TrackFindingAlgorithm : public GaudiAlgorithm { -public: - /// Track finder function that takes input measurements, initial trackstate - /// and track finder options and returns some track-finder-specific result. - using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions; - using TrackFinderResult = std::vector>; - - /// Find function that takes the above parameters - /// @note This is separated into a virtual interface to keep compilation units - /// small - class TrackFinderFunction { - public: - virtual ~TrackFinderFunction() = default; - virtual TrackFinderResult operator()(const TrackParametersContainer&, - const TrackFinderOptions&) const = 0; - }; - - /// Create the track finder function implementation. - /// The magnetic field is intentionally given by-value since the variant - /// contains shared_ptr anyways. - static std::shared_ptr makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField); - -public: - DataHandle m_inputSourceLinks{"inputSourceLinks", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputMeasurements{"inputMeasurements", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputInitialTrackParameters{"inputInitialTrackParameters", - Gaudi::DataHandle::Reader, this}; - DataHandle m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this}; - - Gaudi::Property> m_etaBins{this, "etaBins", {}}; - Gaudi::Property> m_chi2CutOff{this, "chi2CutOff", {15.}}; - Gaudi::Property> m_numMeasurementsCutOff{this, "numMeasurementsCutOff", {10}}; - - std::shared_ptr m_trackFinderFunc; - SmartIF m_geoSvc; - - std::shared_ptr m_BField = nullptr; - Acts::GeometryContext m_geoctx; - Acts::CalibrationContext m_calibctx; - Acts::MagneticFieldContext m_fieldctx; - - Acts::MeasurementSelector::Config m_sourcelinkSelectorCfg; - Acts::Logging::Level m_actsLoggingLevel = Acts::Logging::INFO; - - TrackFindingAlgorithm(const std::string& name, ISvcLocator* svcLoc); - - StatusCode initialize() override; - - StatusCode execute() override; -}; - -} // namespace Jug::Reco - -#endif diff --git a/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithmFunction.h b/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithmFunction.h deleted file mode 100644 index aa360cbf..00000000 --- a/external/algorithms/acts/include/algorithms/acts/TrackFindingAlgorithmFunction.h +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck, Sylvester Joosten - -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" - -#include "TrackFindingAlgorithm.h" - -#include "JugBase/BField/DD4hepBField.h" - - -#include -#include - -namespace { - using Updater = Acts::GainMatrixUpdater; - using Smoother = Acts::GainMatrixSmoother; - - using Stepper = Acts::EigenStepper<>; - using Navigator = Acts::Navigator; - using Propagator = Acts::Propagator; - using CKF = Acts::CombinatorialKalmanFilter; - - /** Finder implmentation . - * - * \ingroup track - */ - struct TrackFinderFunctionImpl - : public Jug::Reco::TrackFindingAlgorithm::TrackFinderFunction { - CKF trackFinder; - - TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {} - - Jug::Reco::TrackFindingAlgorithm::TrackFinderResult - operator()(const Jug::TrackParametersContainer& initialParameters, - const Jug::Reco::TrackFindingAlgorithm::TrackFinderOptions& options) - const override - { - return trackFinder.findTracks(initialParameters, options); - }; - }; - -} // namespace - -namespace Jug::Reco { - - std::shared_ptr - TrackFindingAlgorithm::makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField) - { - Stepper stepper(std::move(magneticField)); - Navigator::Config cfg{trackingGeometry}; - cfg.resolvePassive = false; - cfg.resolveMaterial = true; - cfg.resolveSensitive = true; - Navigator navigator(cfg); - - Propagator propagator(std::move(stepper), std::move(navigator)); - CKF trackFinder(std::move(propagator)); - - // build the track finder functions. onws the track finder object. - return std::make_shared(std::move(trackFinder)); - } - -} // namespace Jug::Reco diff --git a/external/algorithms/acts/src/TrackFindingAlgorithm.cpp b/external/algorithms/acts/src/TrackFindingAlgorithm.cpp deleted file mode 100644 index 1961d50d..00000000 --- a/external/algorithms/acts/src/TrackFindingAlgorithm.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -#include "TrackFindingAlgorithm.h" - -// Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiAlg/Transformer.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiKernel/RndmGenerators.h" -#include "Gaudi/Property.h" - -#include "DDRec/CellIDPositionConverter.h" -#include "DDRec/SurfaceManager.h" -#include "DDRec/Surface.h" - -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp" -#include "Acts/Surfaces/PerigeeSurface.hpp" - -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" -#include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" -#include "Acts/Definitions/Common.hpp" -#include "Acts/Utilities/Helpers.hpp" -#include "Acts/Utilities/Logger.hpp" -#include "Acts/Definitions/Units.hpp" - -#include "JugBase/DataHandle.h" -#include "JugBase/IGeoSvc.h" -#include "JugBase/BField/DD4hepBField.h" - -#include "JugTrack/GeometryContainers.hpp" -#include "JugTrack/Measurement.hpp" -#include "JugTrack/Index.hpp" -#include "JugTrack/IndexSourceLink.hpp" -#include "JugTrack/Track.hpp" - - -#include "edm4eic/TrackerHitCollection.h" - -#include -#include -#include -#include -#include - - -static const std::map s_msgMap = { - {MSG::DEBUG, Acts::Logging::DEBUG}, - {MSG::VERBOSE, Acts::Logging::VERBOSE}, - {MSG::INFO, Acts::Logging::INFO}, - {MSG::WARNING, Acts::Logging::WARNING}, - {MSG::FATAL, Acts::Logging::FATAL}, - {MSG::ERROR, Acts::Logging::ERROR}, -}; - -namespace Jug::Reco { - - using namespace Acts::UnitLiterals; - - TrackFindingAlgorithm::TrackFindingAlgorithm(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { - declareProperty("inputSourceLinks", m_inputSourceLinks, ""); - declareProperty("inputMeasurements", m_inputMeasurements, ""); - declareProperty("inputInitialTrackParameters", m_inputInitialTrackParameters, ""); - declareProperty("outputTrajectories", m_outputTrajectories, ""); - } - - StatusCode TrackFindingAlgorithm::initialize() - { - warning() << "Deprecated algorithm, use CKFTracking instead" << endmsg; - if (GaudiAlgorithm::initialize().isFailure()) { - return StatusCode::FAILURE; - } - m_geoSvc = service("GeoSvc"); - if (!m_geoSvc) { - error() << "Unable to locate Geometry Service. " - << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg; - return StatusCode::FAILURE; - } - - m_BField = std::dynamic_pointer_cast(m_geoSvc->getFieldProvider()); - m_fieldctx = Jug::BField::BFieldVariant(m_BField); - - // eta bins, chi2 and #sourclinks per surface cutoffs - m_sourcelinkSelectorCfg = { - {Acts::GeometryIdentifier(), - {m_etaBins, m_chi2CutOff, - {m_numMeasurementsCutOff.begin(), m_numMeasurementsCutOff.end()} - } - }, - }; - m_trackFinderFunc = TrackFindingAlgorithm::makeTrackFinderFunction(m_geoSvc->trackingGeometry(), m_BField); - auto im = s_msgMap.find(msgLevel()); - if (im != s_msgMap.end()) { - m_actsLoggingLevel = im->second; - } - return StatusCode::SUCCESS; - } - - StatusCode TrackFindingAlgorithm::execute() - { - // Read input data - const auto* const src_links = m_inputSourceLinks.get(); - const auto* const init_trk_params = m_inputInitialTrackParameters.get(); - const auto* const measurements = m_inputMeasurements.get(); - - //// Prepare the output data with MultiTrajectory - // TrajectoryContainer trajectories; - auto* trajectories = m_outputTrajectories.createAndPut(); - trajectories->reserve(init_trk_params->size()); - - //// Construct a perigee surface as the target surface - auto pSurface = Acts::Surface::makeShared(Acts::Vector3{0., 0., 0.}); - - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("TrackFindingAlgorithm Logger", m_actsLoggingLevel)); - - Acts::PropagatorPlainOptions pOptions; - pOptions.maxSteps = 10000; - - MeasurementCalibrator calibrator{*measurements}; - Acts::GainMatrixUpdater kfUpdater; - Acts::GainMatrixSmoother kfSmoother; - Acts::MeasurementSelector measSel{m_sourcelinkSelectorCfg}; - - Acts::CombinatorialKalmanFilterExtensions extensions; - extensions.calibrator.connect<&MeasurementCalibrator::calibrate>(&calibrator); - extensions.updater.connect<&Acts::GainMatrixUpdater::operator()>(&kfUpdater); - extensions.smoother.connect<&Acts::GainMatrixSmoother::operator()>( - &kfSmoother); - extensions.measurementSelector.connect<&Acts::MeasurementSelector::select>( - &measSel); - - IndexSourceLinkAccessor slAccessor; - slAccessor.container = src_links; - Acts::SourceLinkAccessorDelegate - slAccessorDelegate; - slAccessorDelegate.connect<&IndexSourceLinkAccessor::range>(&slAccessor); - - // Set the CombinatorialKalmanFilter options - TrackFindingAlgorithm::TrackFinderOptions options( - m_geoctx, m_fieldctx, m_calibctx, slAccessorDelegate, - extensions, Acts::LoggerWrapper{logger()}, pOptions, &(*pSurface)); - - auto results = (*m_trackFinderFunc)(*init_trk_params, options); - - for (std::size_t iseed = 0; iseed < init_trk_params->size(); ++iseed) { - - auto& result = results[iseed]; - - if (result.ok()) { - // Get the track finding output object - const auto& trackFindingOutput = result.value(); - // Create a SimMultiTrajectory - trajectories->emplace_back(std::move(trackFindingOutput.fittedStates), - std::move(trackFindingOutput.lastMeasurementIndices), - std::move(trackFindingOutput.fittedParameters)); - } else { - if (msgLevel(MSG::DEBUG)) { - debug() << "Track finding failed for truth seed " << iseed << " with error " << result.error() << endmsg; - } - // trajectories->push_back(SimMultiTrajectory()); - } - } - - return StatusCode::SUCCESS; - } - - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackFindingAlgorithm) -} // namespace Jug::Reco diff --git a/external/algorithms/acts/src/TrackFindingAlgorithm.h b/external/algorithms/acts/src/TrackFindingAlgorithm.h deleted file mode 100644 index b5eeca42..00000000 --- a/external/algorithms/acts/src/TrackFindingAlgorithm.h +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck - -#ifndef JUGGLER_JUGRECO_TrackFindingAlgorithm_HH -#define JUGGLER_JUGRECO_TrackFindingAlgorithm_HH - -#include -#include -#include -#include - -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "JugBase/DataHandle.h" -#include "JugBase/IGeoSvc.h" -#include "JugBase/BField/DD4hepBField.h" -#include "JugTrack/GeometryContainers.hpp" -#include "JugTrack/Index.hpp" -#include "JugTrack/IndexSourceLink.hpp" -#include "JugTrack/Measurement.hpp" -#include "JugTrack/Track.hpp" -#include "JugTrack/Trajectories.hpp" - -#include "edm4eic/TrackerHitCollection.h" - -#include "Acts/Definitions/Common.hpp" -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" -#include "Acts/TrackFinding/MeasurementSelector.hpp" - -namespace Jug::Reco { - -/** Fitting algorithm implmentation . - * - * \ingroup tracking - */ -class TrackFindingAlgorithm : public GaudiAlgorithm { -public: - /// Track finder function that takes input measurements, initial trackstate - /// and track finder options and returns some track-finder-specific result. - using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions; - using TrackFinderResult = std::vector>; - - /// Find function that takes the above parameters - /// @note This is separated into a virtual interface to keep compilation units - /// small - class TrackFinderFunction { - public: - virtual ~TrackFinderFunction() = default; - virtual TrackFinderResult operator()(const TrackParametersContainer&, - const TrackFinderOptions&) const = 0; - }; - - /// Create the track finder function implementation. - /// The magnetic field is intentionally given by-value since the variant - /// contains shared_ptr anyways. - static std::shared_ptr makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField); - -public: - DataHandle m_inputSourceLinks{"inputSourceLinks", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputMeasurements{"inputMeasurements", Gaudi::DataHandle::Reader, this}; - DataHandle m_inputInitialTrackParameters{"inputInitialTrackParameters", - Gaudi::DataHandle::Reader, this}; - DataHandle m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this}; - - Gaudi::Property> m_etaBins{this, "etaBins", {}}; - Gaudi::Property> m_chi2CutOff{this, "chi2CutOff", {15.}}; - Gaudi::Property> m_numMeasurementsCutOff{this, "numMeasurementsCutOff", {10}}; - - std::shared_ptr m_trackFinderFunc; - SmartIF m_geoSvc; - - std::shared_ptr m_BField = nullptr; - Acts::GeometryContext m_geoctx; - Acts::CalibrationContext m_calibctx; - Acts::MagneticFieldContext m_fieldctx; - - Acts::MeasurementSelector::Config m_sourcelinkSelectorCfg; - Acts::Logging::Level m_actsLoggingLevel = Acts::Logging::INFO; - - TrackFindingAlgorithm(const std::string& name, ISvcLocator* svcLoc); - - StatusCode initialize() override; - - StatusCode execute() override; -}; - -} // namespace Jug::Reco - -#endif diff --git a/external/algorithms/acts/src/TrackFindingAlgorithmFunction.cpp b/external/algorithms/acts/src/TrackFindingAlgorithmFunction.cpp deleted file mode 100644 index aa360cbf..00000000 --- a/external/algorithms/acts/src/TrackFindingAlgorithmFunction.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck, Sylvester Joosten - -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/Navigator.hpp" -#include "Acts/Propagator/Propagator.hpp" -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" - -#include "TrackFindingAlgorithm.h" - -#include "JugBase/BField/DD4hepBField.h" - - -#include -#include - -namespace { - using Updater = Acts::GainMatrixUpdater; - using Smoother = Acts::GainMatrixSmoother; - - using Stepper = Acts::EigenStepper<>; - using Navigator = Acts::Navigator; - using Propagator = Acts::Propagator; - using CKF = Acts::CombinatorialKalmanFilter; - - /** Finder implmentation . - * - * \ingroup track - */ - struct TrackFinderFunctionImpl - : public Jug::Reco::TrackFindingAlgorithm::TrackFinderFunction { - CKF trackFinder; - - TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {} - - Jug::Reco::TrackFindingAlgorithm::TrackFinderResult - operator()(const Jug::TrackParametersContainer& initialParameters, - const Jug::Reco::TrackFindingAlgorithm::TrackFinderOptions& options) - const override - { - return trackFinder.findTracks(initialParameters, options); - }; - }; - -} // namespace - -namespace Jug::Reco { - - std::shared_ptr - TrackFindingAlgorithm::makeTrackFinderFunction( - std::shared_ptr trackingGeometry, - std::shared_ptr magneticField) - { - Stepper stepper(std::move(magneticField)); - Navigator::Config cfg{trackingGeometry}; - cfg.resolvePassive = false; - cfg.resolveMaterial = true; - cfg.resolveSensitive = true; - Navigator navigator(cfg); - - Propagator propagator(std::move(stepper), std::move(navigator)); - CKF trackFinder(std::move(propagator)); - - // build the track finder functions. onws the track finder object. - return std::make_shared(std::move(trackFinder)); - } - -} // namespace Jug::Reco diff --git a/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector.h b/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector.h deleted file mode 100644 index 0e4d1ea7..00000000 --- a/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector.h +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Sylvester Joosten, Chao Peng - -// Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/Transformer.h" - -#include "JugBase/DataHandle.h" - -// Event Model related classes -#include "edm4eic/TrackerHitCollection.h" - -namespace Jug::Reco { - - /** Collect the tracking hits into a single collection. - * - * \ingroup reco - */ - class TrackingHitsCollector : public GaudiAlgorithm { - private: - DataHandle m_trackerBarrelHits{"trackerBarrelHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_trackerEndcapHits{"trackerEndcapHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexBarrelHits {"vertexBarrelHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexEndcapHits {"vertexEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_gemEndcapHits {"gemEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; - - public: - TrackingHitsCollector(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { - declareProperty("trackerBarrelHits", m_trackerBarrelHits, ""); - declareProperty("trackerEndcapHits", m_trackerEndcapHits, ""); - declareProperty("vertexBarrelHits" , m_vertexBarrelHits , ""); - declareProperty("vertexEndcapHits" , m_vertexEndcapHits , ""); - declareProperty("gemEndcapHits" , m_gemEndcapHits , ""); - declareProperty("outputHitCollection", m_outputHitCollection, ""); - } - - StatusCode initialize() override - { - warning() << "DEPRECATED, use TrackingHitsCollector2 instead" << endmsg; - return StatusCode::SUCCESS; - } - - StatusCode execute() override - { - const edm4eic::TrackerHitCollection* trkBarrelHits = m_trackerBarrelHits.get(); - const edm4eic::TrackerHitCollection* trkEndcapHits = m_trackerEndcapHits.get(); - const edm4eic::TrackerHitCollection* vtxBarrelHits = m_vertexBarrelHits .get(); - const edm4eic::TrackerHitCollection* vtxEndcapHits = m_vertexEndcapHits .get(); - const edm4eic::TrackerHitCollection* gemEndcapHits = m_gemEndcapHits .get(); - auto* outputHits = m_outputHitCollection.createAndPut(); - - for (const auto* hits : {trkBarrelHits, trkEndcapHits, vtxBarrelHits, vtxEndcapHits, gemEndcapHits}) { - if (hits != nullptr) { - for (const auto& ahit : *hits) { - auto new_hit = ahit.clone(); - outputHits->push_back(ahit.clone()); - } - } - } - - return StatusCode::SUCCESS; - } - }; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackingHitsCollector) - -} // namespace Jug::Reco diff --git a/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector2.h b/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector2.h index 17afb4f2..185bcb9c 100644 --- a/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector2.h +++ b/external/algorithms/utility/include/algorithms/utility/todo/TrackingHitsCollector2.h @@ -71,6 +71,8 @@ namespace Jug::Reco { } }; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) + DECLARE_COMPONENT(TrackingHitsCollector) + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(TrackingHitsCollector2) } // namespace Jug::Reco diff --git a/external/algorithms/utility/src/todo/TrackingHitsCollector.cpp b/external/algorithms/utility/src/todo/TrackingHitsCollector.cpp deleted file mode 100644 index 0e4d1ea7..00000000 --- a/external/algorithms/utility/src/todo/TrackingHitsCollector.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Sylvester Joosten, Chao Peng - -// Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" -#include "Gaudi/Property.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiAlg/Transformer.h" - -#include "JugBase/DataHandle.h" - -// Event Model related classes -#include "edm4eic/TrackerHitCollection.h" - -namespace Jug::Reco { - - /** Collect the tracking hits into a single collection. - * - * \ingroup reco - */ - class TrackingHitsCollector : public GaudiAlgorithm { - private: - DataHandle m_trackerBarrelHits{"trackerBarrelHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_trackerEndcapHits{"trackerEndcapHits", Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexBarrelHits {"vertexBarrelHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_vertexEndcapHits {"vertexEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_gemEndcapHits {"gemEndcapHits" , Gaudi::DataHandle::Reader, this}; - DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; - - public: - TrackingHitsCollector(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { - declareProperty("trackerBarrelHits", m_trackerBarrelHits, ""); - declareProperty("trackerEndcapHits", m_trackerEndcapHits, ""); - declareProperty("vertexBarrelHits" , m_vertexBarrelHits , ""); - declareProperty("vertexEndcapHits" , m_vertexEndcapHits , ""); - declareProperty("gemEndcapHits" , m_gemEndcapHits , ""); - declareProperty("outputHitCollection", m_outputHitCollection, ""); - } - - StatusCode initialize() override - { - warning() << "DEPRECATED, use TrackingHitsCollector2 instead" << endmsg; - return StatusCode::SUCCESS; - } - - StatusCode execute() override - { - const edm4eic::TrackerHitCollection* trkBarrelHits = m_trackerBarrelHits.get(); - const edm4eic::TrackerHitCollection* trkEndcapHits = m_trackerEndcapHits.get(); - const edm4eic::TrackerHitCollection* vtxBarrelHits = m_vertexBarrelHits .get(); - const edm4eic::TrackerHitCollection* vtxEndcapHits = m_vertexEndcapHits .get(); - const edm4eic::TrackerHitCollection* gemEndcapHits = m_gemEndcapHits .get(); - auto* outputHits = m_outputHitCollection.createAndPut(); - - for (const auto* hits : {trkBarrelHits, trkEndcapHits, vtxBarrelHits, vtxEndcapHits, gemEndcapHits}) { - if (hits != nullptr) { - for (const auto& ahit : *hits) { - auto new_hit = ahit.clone(); - outputHits->push_back(ahit.clone()); - } - } - } - - return StatusCode::SUCCESS; - } - }; - // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - DECLARE_COMPONENT(TrackingHitsCollector) - -} // namespace Jug::Reco diff --git a/external/algorithms/utility/src/todo/TrackingHitsCollector2.cpp b/external/algorithms/utility/src/todo/TrackingHitsCollector2.cpp index 17afb4f2..185bcb9c 100644 --- a/external/algorithms/utility/src/todo/TrackingHitsCollector2.cpp +++ b/external/algorithms/utility/src/todo/TrackingHitsCollector2.cpp @@ -71,6 +71,8 @@ namespace Jug::Reco { } }; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) + DECLARE_COMPONENT(TrackingHitsCollector) + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(TrackingHitsCollector2) } // namespace Jug::Reco