6 #include <Acts/Utilities/Enumerate.hpp>
9 using namespace SegmentFit;
14 m_cfg{std::move(
cfg)} {}
22 std::ranges::stable_sort(toResolve,[
this](
const SegmentVec::value_type&
a,
23 const SegmentVec::value_type&
b){
27 return a->nDoF() >
b->nDoF();
29 return redChi2A < redChi2B;
34 resolved.push_back(std::move(toResolve[0]));
35 toResolve.erase(toResolve.begin());
36 std::vector<std::vector<int>> segmentSigns{
driftSigns(gctx, *resolved.front(), resolved.front()->measurements())};
37 std::vector<MeasurementSet> segMeasurements{
extractPrds(*resolved.front())};
39 for (std::unique_ptr<Segment>& resolveMe : toResolve) {
44 unsigned int resolvedIdx{0};
45 for (std::unique_ptr<Segment>& goodSeg : resolved) {
48 std::vector<int>& existSigns{segmentSigns[resolvedIdx++]};
49 unsigned int shared =
countShared(resolvedM, testMeas);
54 const std::vector<int> reEvaluatedSigns{
driftSigns(gctx, *resolveMe, goodSeg->measurements())};
56 unsigned int sameSides{0};
57 for (
unsigned int s =0 ;
s < existSigns.size(); ++
s) {
58 sameSides += (reEvaluatedSigns[
s] == existSigns[
s]);
60 if (sameSides != existSigns.size() && resolveMe->nDoF() == goodSeg->nDoF()) {
61 ATH_MSG_VERBOSE(
"Reference signs: "<<existSigns<<
" / re-evaluated: "<<reEvaluatedSigns);
65 const double resolvedChi2 =
redChi2(*goodSeg);
66 const double resolveMeChi2 =
redChi2(*resolveMe);
67 ATH_MSG_VERBOSE(
"Chi2 good "<<resolvedChi2<<
", candidate chi2: "<<resolveMeChi2);
71 if (resolveMe->nDoF() > goodSeg->nDoF()){
74 }
else if (resolveMeChi2 < resolvedChi2) {
80 existSigns =
driftSigns(gctx, *resolveMe, resolveMe->measurements());
84 segMeasurements.push_back(std::move(testMeas));
85 segmentSigns.push_back(
driftSigns(gctx, *resolveMe, resolveMe->measurements()));
86 resolved.push_back(std::move(resolveMe));
94 std::vector<int> signs{};
95 signs.reserve(measurements.size());
99 for (
const Segment::MeasVec::value_type& hit : measurements) {
100 if (!hit->spacePoint()) {
111 for (
const Segment::MeasVec::value_type& hit :
segment.measurements()) {
115 meas.insert(hit->spacePoint()->primaryMeasurement());
116 if (hit->spacePoint()->secondaryMeasurement()) {
117 meas.insert(hit->spacePoint()->secondaryMeasurement());
124 if (measSet1.size() > measSet2.size()) {
126 return measSet1.count(meas);
130 return measSet2.count(meas);