ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsTrackReconstruction
src
detail
FitterHelperFunctions.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef ACTSGEOMETRY_FITTERHELPER_H
6
#define ACTSGEOMETRY_FITTERHELPER_H
7
8
// ATHENA
9
#include "
TRT_ReadoutGeometry/TRT_BaseElement.h
"
10
11
// ACTS
12
#include "Acts/TrackFitting/GainMatrixSmoother.hpp"
13
#include "Acts/TrackFitting/GainMatrixUpdater.hpp"
14
#include "Acts/TrackFitting/MbfSmoother.hpp"
15
16
// PACKAGE
17
#include "
ActsGeometry/ActsDetectorElement.h
"
18
19
namespace
ActsTrk::detail::FitterHelperFunctions
{
20
21
template
<
typename
trajectory_t>
22
Acts::Result<void>
gainMatrixUpdate
(
const
Acts::GeometryContext& gctx,
23
typename
trajectory_t::TrackStateProxy trackState,
24
const
Acts::Logger&
logger
) {
25
Acts::GainMatrixUpdater updater;
26
return
updater.template operator()<trajectory_t>(gctx, trackState,
logger
);
27
}
28
29
template
<
typename
trajectory_t>
30
Acts::Result<void>
gainMatrixSmoother
(
const
Acts::GeometryContext& gctx,
31
trajectory_t& trajectory,
32
size_t
entryIndex,
33
const
Acts::Logger&
logger
) {
34
Acts::GainMatrixSmoother smoother;
35
return
smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex,
logger
);
36
}
37
38
template
<
typename
trajectory_t>
39
Acts::Result<void>
mbfSmoother
(
const
Acts::GeometryContext& gctx,
40
trajectory_t& trajectory,
41
size_t
entryIndex,
42
const
Acts::Logger&
logger
) {
43
Acts::MbfSmoother smoother;
44
return
smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex,
logger
);
45
}
46
48
struct
ATLASOutlierFinder
{
49
double
StateChiSquaredPerNumberDoFCut
= std::numeric_limits<double>::max();
56
template
<
typename
trajectory_t>
57
bool
operator()
(
typename
Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy state)
const
{
58
// can't determine an outlier w/o a measurement or predicted parameters
59
if
(not state.hasCalibrated() or not state.hasPredicted()) {
60
return
false
;
61
}
62
return
Acts::visit_measurement(
63
state.calibratedSize(),
64
[&] (
auto
N
) ->
bool
{
65
constexpr size_t kMeasurementSize = decltype(N)::value;
66
67
auto subspaceHelper = state.template projectorSubspaceHelper<kMeasurementSize>();
68
69
typename Acts::TrackStateTraits<kMeasurementSize, true>::Calibrated calibrated{
70
state.template calibrated<Acts::kMeasurementSizeMax>().data()};
71
72
typename
Acts::TrackStateTraits<kMeasurementSize, true>::CalibratedCovariance
73
calibratedCovariance{state.template calibratedCovariance<Acts::kMeasurementSizeMax>().data()};
74
75
// Take the projector (measurement mapping function)
76
// TODO use the subspace helper directly
77
const
auto
H
= subspaceHelper.projector();
78
79
const
auto
residual = calibrated -
H
* state.predicted();
80
double
chi2
= (residual.transpose() * (calibratedCovariance +
H
* state.predictedCovariance() *
H
.transpose()).inverse() * residual).value();
81
return (
chi2
>
StateChiSquaredPerNumberDoFCut
* kMeasurementSize);
82
});
83
}
84
};
85
88
struct
ReverseFilteringLogic
{
89
double
momentumMax
= std::numeric_limits<double>::max();
90
98
template
<
typename
trajectory_t>
99
bool
operator()
(
typename
Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy trackState)
const
{
100
// can't determine an outlier w/o a measurement or predicted parameters
101
auto
momentum = std::abs(1. / trackState.filtered()[Acts::eBoundQOverP]);
102
return
(momentum <=
momentumMax
);
103
}
104
};
105
106
}
// namespace
107
108
#endif
ActsDetectorElement.h
H
#define H(x, y, z)
Definition
MD5.cxx:114
TRT_BaseElement.h
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition
comparitor.cxx:525
logger
static Root::TMsgLogger logger("iLumiCalc")
ActsTrk::detail::FitterHelperFunctions
Definition
FitterHelperFunctions.h:19
ActsTrk::detail::FitterHelperFunctions::gainMatrixUpdate
Acts::Result< void > gainMatrixUpdate(const Acts::GeometryContext &gctx, typename trajectory_t::TrackStateProxy trackState, const Acts::Logger &logger)
Definition
FitterHelperFunctions.h:22
ActsTrk::detail::FitterHelperFunctions::gainMatrixSmoother
Acts::Result< void > gainMatrixSmoother(const Acts::GeometryContext &gctx, trajectory_t &trajectory, size_t entryIndex, const Acts::Logger &logger)
Definition
FitterHelperFunctions.h:30
ActsTrk::detail::FitterHelperFunctions::mbfSmoother
Acts::Result< void > mbfSmoother(const Acts::GeometryContext &gctx, trajectory_t &trajectory, size_t entryIndex, const Acts::Logger &logger)
Definition
FitterHelperFunctions.h:39
ActsTrk::detail::HitCategory::N
@ N
Definition
HitSummaryDataUtils.h:23
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder
Outlier finder using a Chi2 cut.
Definition
FitterHelperFunctions.h:48
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder::StateChiSquaredPerNumberDoFCut
double StateChiSquaredPerNumberDoFCut
Definition
FitterHelperFunctions.h:49
ActsTrk::detail::FitterHelperFunctions::ATLASOutlierFinder::operator()
bool operator()(typename Acts::MultiTrajectory< trajectory_t >::ConstTrackStateProxy state) const
Classify a measurement as a valid one or an outlier.
Definition
FitterHelperFunctions.h:57
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic
Determine if the smoothing of a track should be done with or without reverse filtering.
Definition
FitterHelperFunctions.h:88
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic::operator()
bool operator()(typename Acts::MultiTrajectory< trajectory_t >::ConstTrackStateProxy trackState) const
Determine if the smoothing of a track should be done with or without reverse filtering.
Definition
FitterHelperFunctions.h:99
ActsTrk::detail::FitterHelperFunctions::ReverseFilteringLogic::momentumMax
double momentumMax
Definition
FitterHelperFunctions.h:89
Generated on
for ATLAS Offline Software by
1.17.0