Skip to content

Commit bd21af9

Browse files
committed
Updates
1 parent e999e68 commit bd21af9

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

source/tdis/tracking/KalmanFittingFactory.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050

5151
#include <extensions/spdlog/SpdlogToActs.h>
5252

53+
#include "TrackFitterFunction.hpp"
54+
55+
56+
namespace ActsExamples {
57+
class TrackFitterFunction;
58+
}
5359

5460
void tdis::tracking::KalmanFittingFactory::Configure()
5561
{
@@ -81,6 +87,31 @@ void tdis::tracking::KalmanFittingFactory::Execute(int32_t runNumber, uint64_t e
8187

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

90+
// Construct a perigee surface as the target surface
91+
auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
92+
Acts::Vector3{0., 0., 0.});
93+
94+
// Type erased calibrator for the measurements
95+
std::shared_ptr<ActsExamples::MeasurementCalibrator> calibrator;
96+
97+
double bz = 1.5 * Acts::UnitConstants::T;
98+
99+
auto field = std::make_shared<Acts::ConstantBField>(Acts::Vector3(0.0, 0.0, bz));
100+
101+
102+
// Construct the MagneticFieldContext using the cache
103+
Acts::MagneticFieldContext magFieldContext;
104+
// Create a cache for the magnetic field
105+
//Acts::ConstantBField::Cache magFieldCache = field->makeCache(magFieldContext);
106+
Acts::CalibrationContext calibrationContext;
107+
108+
ActsExamples::TrackFitterFunction::GeneralFitterOptions options{
109+
110+
m_serviceGeometry->GetActsGeometryContext(),
111+
magFieldContext, calibrationContext, pSurface.get(),
112+
Acts::PropagatorPlainOptions(m_serviceGeometry->GetActsGeometryContext(), magFieldContext)};
113+
114+
84115
}
85116

86117
template <typename stepper_t>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// This file is part of the ACTS project.
2+
//
3+
// Copyright (C) 2016 CERN for the benefit of the ACTS project
4+
//
5+
// This Source Code Form is subject to the terms of the Mozilla Public
6+
// License, v. 2.0. If a copy of the MPL was not distributed with this
7+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
#pragma once
10+
11+
#include "Acts/Utilities/Logger.hpp"
12+
#include "ActsExamples/EventData/Cluster.hpp"
13+
#include "ActsExamples/EventData/IndexSourceLink.hpp"
14+
#include "ActsExamples/EventData/Measurement.hpp"
15+
#include "ActsExamples/EventData/ProtoTrack.hpp"
16+
#include "ActsExamples/EventData/Track.hpp"
17+
#include "ActsExamples/Framework/DataHandle.hpp"
18+
#include "ActsExamples/Framework/IAlgorithm.hpp"
19+
#include "ActsExamples/Framework/ProcessCode.hpp"
20+
#include "ActsExamples/TrackFitting/TrackFitterFunction.hpp"
21+
22+
#include <memory>
23+
#include <string>
24+
25+
namespace Acts {
26+
class TrackingGeometry;
27+
}
28+
29+
namespace ActsExamples {
30+
class MeasurementCalibrator;
31+
class TrackFitterFunction;
32+
struct AlgorithmContext;
33+
34+
class TrackFittingAlgorithm final : public IAlgorithm {
35+
public:
36+
struct Config {
37+
/// Input measurements collection.
38+
std::string inputMeasurements;
39+
/// Input proto tracks collection, i.e. groups of hit indices.
40+
std::string inputProtoTracks;
41+
/// Input initial track parameter estimates for for each proto track.
42+
std::string inputInitialTrackParameters;
43+
/// (optional) Input clusters for each measurement
44+
std::string inputClusters;
45+
/// Output fitted tracks collection.
46+
std::string outputTracks;
47+
/// Type erased fitter function.
48+
std::shared_ptr<TrackFitterFunction> fit;
49+
/// Pick a single track for debugging (-1 process all tracks)
50+
int pickTrack = -1;
51+
// Type erased calibrator for the measurements
52+
std::shared_ptr<MeasurementCalibrator> calibrator;
53+
};
54+
55+
/// Constructor of the fitting algorithm
56+
///
57+
/// @param config is the config struct to configure the algorithm
58+
/// @param level is the logging level
59+
TrackFittingAlgorithm(Config config, Acts::Logging::Level level);
60+
61+
/// Framework execute method of the fitting algorithm
62+
///
63+
/// @param ctx is the algorithm context that holds event-wise information
64+
/// @return a process code to steer the algporithm flow
65+
ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const final;
66+
67+
/// Get readonly access to the config parameters
68+
const Config& config() const { return m_cfg; }
69+
70+
private:
71+
Config m_cfg;
72+
73+
ReadDataHandle<MeasurementContainer> m_inputMeasurements{this,
74+
"InputMeasurements"};
75+
ReadDataHandle<ProtoTrackContainer> m_inputProtoTracks{this,
76+
"InputProtoTracks"};
77+
ReadDataHandle<TrackParametersContainer> m_inputInitialTrackParameters{
78+
this, "InputInitialTrackParameters"};
79+
80+
ReadDataHandle<ClusterContainer> m_inputClusters{this, "InputClusters"};
81+
82+
WriteDataHandle<ConstTrackContainer> m_outputTracks{this, "OutputTracks"};
83+
};
84+
85+
} // namespace ActsExamples

0 commit comments

Comments
 (0)