Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 25, 2024
1 parent e999e68 commit bd21af9
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
31 changes: 31 additions & 0 deletions source/tdis/tracking/KalmanFittingFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@

#include <extensions/spdlog/SpdlogToActs.h>

#include "TrackFitterFunction.hpp"


namespace ActsExamples {
class TrackFitterFunction;
}

void tdis::tracking::KalmanFittingFactory::Configure()
{
Expand Down Expand Up @@ -81,6 +87,31 @@ void tdis::tracking::KalmanFittingFactory::Execute(int32_t runNumber, uint64_t e

std::shared_ptr<ActsExamples::TrackFitterFunction> fit;

// Construct a perigee surface as the target surface
auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
Acts::Vector3{0., 0., 0.});

// Type erased calibrator for the measurements
std::shared_ptr<ActsExamples::MeasurementCalibrator> calibrator;

double bz = 1.5 * Acts::UnitConstants::T;

auto field = std::make_shared<Acts::ConstantBField>(Acts::Vector3(0.0, 0.0, bz));


// Construct the MagneticFieldContext using the cache
Acts::MagneticFieldContext magFieldContext;
// Create a cache for the magnetic field
//Acts::ConstantBField::Cache magFieldCache = field->makeCache(magFieldContext);
Acts::CalibrationContext calibrationContext;

ActsExamples::TrackFitterFunction::GeneralFitterOptions options{

m_serviceGeometry->GetActsGeometryContext(),
magFieldContext, calibrationContext, pSurface.get(),
Acts::PropagatorPlainOptions(m_serviceGeometry->GetActsGeometryContext(), magFieldContext)};


}

template <typename stepper_t>
Expand Down
85 changes: 85 additions & 0 deletions source/tdis/tracking/TrackFittingAlgorithm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Utilities/Logger.hpp"
#include "ActsExamples/EventData/Cluster.hpp"
#include "ActsExamples/EventData/IndexSourceLink.hpp"
#include "ActsExamples/EventData/Measurement.hpp"
#include "ActsExamples/EventData/ProtoTrack.hpp"
#include "ActsExamples/EventData/Track.hpp"
#include "ActsExamples/Framework/DataHandle.hpp"
#include "ActsExamples/Framework/IAlgorithm.hpp"
#include "ActsExamples/Framework/ProcessCode.hpp"
#include "ActsExamples/TrackFitting/TrackFitterFunction.hpp"

#include <memory>
#include <string>

namespace Acts {
class TrackingGeometry;
}

namespace ActsExamples {
class MeasurementCalibrator;
class TrackFitterFunction;
struct AlgorithmContext;

class TrackFittingAlgorithm final : public IAlgorithm {
public:
struct Config {
/// Input measurements collection.
std::string inputMeasurements;
/// Input proto tracks collection, i.e. groups of hit indices.
std::string inputProtoTracks;
/// Input initial track parameter estimates for for each proto track.
std::string inputInitialTrackParameters;
/// (optional) Input clusters for each measurement
std::string inputClusters;
/// Output fitted tracks collection.
std::string outputTracks;
/// Type erased fitter function.
std::shared_ptr<TrackFitterFunction> fit;
/// Pick a single track for debugging (-1 process all tracks)
int pickTrack = -1;
// Type erased calibrator for the measurements
std::shared_ptr<MeasurementCalibrator> calibrator;
};

/// Constructor of the fitting algorithm
///
/// @param config is the config struct to configure the algorithm
/// @param level is the logging level
TrackFittingAlgorithm(Config config, Acts::Logging::Level level);

/// Framework execute method of the fitting algorithm
///
/// @param ctx is the algorithm context that holds event-wise information
/// @return a process code to steer the algporithm flow
ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const final;

/// Get readonly access to the config parameters
const Config& config() const { return m_cfg; }

private:
Config m_cfg;

ReadDataHandle<MeasurementContainer> m_inputMeasurements{this,
"InputMeasurements"};
ReadDataHandle<ProtoTrackContainer> m_inputProtoTracks{this,
"InputProtoTracks"};
ReadDataHandle<TrackParametersContainer> m_inputInitialTrackParameters{
this, "InputInitialTrackParameters"};

ReadDataHandle<ClusterContainer> m_inputClusters{this, "InputClusters"};

WriteDataHandle<ConstTrackContainer> m_outputTracks{this, "OutputTracks"};
};

} // namespace ActsExamples

0 comments on commit bd21af9

Please sign in to comment.